2018-02-25 20:00:02 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-02-25 20:43:54 +01:00
|
|
|
function detectorTryInit(){
|
|
|
|
# repo dir
|
|
|
|
dir=$1
|
|
|
|
history=$DET_DIR/detectorExecuted
|
|
|
|
|
|
|
|
if ! [ -f $history ]
|
|
|
|
then
|
|
|
|
echo "Initializing detector cache"
|
|
|
|
# initialize seed
|
|
|
|
git --git-dir $dir log --all --format="%H" > $history
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2018-02-25 20:00:02 +01:00
|
|
|
function detectorCheckCommit(){
|
|
|
|
sha=$1
|
|
|
|
history=$DET_DIR/detectorExecuted
|
|
|
|
[ -f $history ] || touch $history
|
|
|
|
|
|
|
|
if grep -q $sha $history
|
|
|
|
then
|
|
|
|
return 1
|
|
|
|
else
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function detectorSaveCommit(){
|
|
|
|
sha=$1
|
|
|
|
history=$DET_DIR/detectorExecuted
|
|
|
|
echo $sha >> $history
|
|
|
|
}
|