Testing git runner
This commit is contained in:
@@ -7,6 +7,7 @@ mydir=$(dirname $(realpath $0))
|
||||
source $mydir/cloner-lib-general
|
||||
source $mydir/cloner-lib-auth
|
||||
source $mydir/cloner-lib-cfg
|
||||
source $mydir/detector-lib-cfg
|
||||
|
||||
|
||||
# interval - in minutes
|
||||
@@ -46,4 +47,57 @@ fi
|
||||
|
||||
date +"%s" > $stampfile
|
||||
|
||||
# if detector is not enabled, quit quietly
|
||||
if ! detectorRunCapable
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
source $mydir/detector-lib-git
|
||||
|
||||
detectorLoadConfig
|
||||
|
||||
repodir=$(gen-mirror-path $repo)
|
||||
|
||||
if detectorCheckFetchHead $repodir
|
||||
then
|
||||
# nothing changed, just die
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# now, the fun begins!
|
||||
|
||||
# first, solve commits
|
||||
|
||||
# solve tags - remove nonexistent refs
|
||||
find $DET_TAGS -type f | sort | while read tagname
|
||||
do
|
||||
tag=$(basename $tagname)
|
||||
if ! git --git-dir $repodir tag -l | grep -q "^$tag$"
|
||||
then
|
||||
echo "Removing tag: $tag (was [$(cat $tagname)])"
|
||||
rm $tagname
|
||||
fi
|
||||
done
|
||||
|
||||
# tags that changed or was pushed as new
|
||||
git --git-dir $repodir tag -l | while read tagname
|
||||
do
|
||||
[ -f $DET_TAGS/$tagname ] || touch $DET_TAGS/$tagname
|
||||
oldsha=$(cat $DET_TAGS/$tagname)
|
||||
newsha=$(git --git-dir $repodir show-ref $tagname | cut -d' ' -f1)
|
||||
if ! [ "$oldsha" = "$newsha" ]
|
||||
then
|
||||
# TAG_HASH = $newsha
|
||||
# TAG_AUTHOR
|
||||
git --git-dir $repodir log $newsha -1 --pretty=format:"%an"
|
||||
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
|
||||
|
||||
# save hash to keep things clear
|
||||
#detectorSumPersist $repodir
|
||||
|
||||
|
||||
Reference in New Issue
Block a user