diff --git a/old/checker/run-checker b/old/checker/run-checker deleted file mode 100755 index ce6b219..0000000 --- a/old/checker/run-checker +++ /dev/null @@ -1,133 +0,0 @@ -#!/bin/bash -set -euo pipefail -IFS=$'\n\t' - - -prepareGitAuth $CONFIG_DIR - - -# if detector is not enabled, quit quietly -if ! detectorRunCapable -then - exit 0 -fi - -source $mydir/detector-lib-git -source $mydir/detector-lib-general - -detectorLoadConfig - -repodir=$(gen-mirror-path $repo) - -if detectorCheckFetchHead $repodir -then - # nothing changed, just die - exit 0 -fi - -# try to init cache -detectorTryInit $repodir - -# first, solve commits -# branches that were deleted or merged -find $DET_BRANCHES -type f | sort | while read branchpath -do - branch=$(basename $branchpath) - if ! gitListBranches $repodir | grep -q "^$branch$" - then - echo "Unexistent branch <$branch>!!" - # rm it, should be merget etc... - rm $DET_BRANCHES/$branch - fi -done - -# new branches or new commits in curent branches -# firstly list master branch, to make first commits in it -gitPrefBranches $repodir | while read branch -do - [ -f $DET_BRANCHES/$branch ] || touch $DET_BRANCHES/$branch - oldsha=$(cat $DET_BRANCHES/$branch) - newsha=$(git --git-dir $repodir show-ref --heads $branch | cut -d' ' -f1) - [ -z "$oldsha" ] || oldsha=$oldsha.. - # walk through every commit in branch (since last change) - for commitId in $(git --no-pager --git-dir $repodir log --reverse --format="%H" $oldsha$branch) - do - if detectorCheckCommit $commitId - then - # commit was not processed - start - # COMMIT = $commitId - # COMMIT_AUTHOR = $author - author=$(git --git-dir $repodir log $commitId -1 --format="%an <%ae>") - # COMMIT_ABBREV - abbr=$(git --git-dir $repodir log $commitId -1 --format="%h") - # COMMIT_LOG - log=$(git --git-dir $repodir log $commitId -1 --format="%s") - # BRANCH = $branch - # PORJECT_NAME = $cloner_project_name - - set +e - COMMIT="$commitId" \ - COMMIT_AUTHOR="$author" \ - COMMIT_BRANCH="$branch" \ - COMMIT_ABBREV="$abbr" \ - COMMIT_LOG="$log" \ - PROJECT_NAME="$cloner_project_name" \ - notify-commit - rc=$? - [ $rc -eq 0 ] || echo "Notify $branch/$commitId: return code = $rc" - set -e - detectorSaveCommit $commitId - fi - - done - echo $newsha > $DET_BRANCHES/$branch -done - - -# solve tags - remove nonexistent refs -find $DET_TAGS -type f | sort | while read tagname -do - tag=$(basename $tagname) - if ! git --git-dir="$repodir" rev-parse "tags/$tag" > /dev/null 2>&1 - then - echo "Removing tag: $tag (was [$(cat $tagname)])" - rm $tagname - fi -done - -# tags that changed or were pushed as new -gitListTags $repodir | while read tagname -do - [ -f $DET_TAGS/$tagname ] || touch $DET_TAGS/$tagname - oldsha=$(cat $DET_TAGS/$tagname) - newsha=$(git --git-dir $repodir show-ref --tags $tagname | cut -d' ' -f1) - if ! [ "x$oldsha" = "x$newsha" ] - then - # TAG_HASH = $newsha - # TAG_NAME = $tagname - # TAG_AUTHOR - author=$(git --git-dir $repodir log $newsha -1 --pretty=format:"%an <%ae>") - # TAG_ABBREV - abbr=$(git --git-dir $repodir log $newsha -1 --format="%h") - # TAG_LOG - log=$(git --git-dir $repodir log $newsha -1 --format="%s") - # PROJECT_NAME = $cloner_project_name - - # call the notify script - set +e - TAG_HASH="$newsha" \ - TAG_NAME="$tagname" \ - TAG_AUTHOR="$author" \ - TAG_ABBREV="$abbr" \ - TAG_LOG="$log" \ - PROJECT_NAME="$cloner_project_name" notify-tag - rc=$? - [ $rc -eq 0 ] || echo "Notify $tagname: return code = $rc" - set -e - fi - echo $newsha > $DET_TAGS/$tagname -done - -# save hash to keep things clear -detectorSumPersist $repodir -