Grab latest commit

This commit is contained in:
Manevolent 2022-12-17 19:33:11 -07:00 committed by GitHub
parent ae48e33b42
commit 18f4440487
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

12
run.sh
View File

@ -22,23 +22,25 @@ do
fi fi
done done
git fetch $GIT_URL >> $log 2>&1 git fetch $GIT_URL >> /dev/null
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Git fetch from $GIT_URL failed. For more details, see $log" echo "Git fetch from $GIT_URL failed."
sleep $delay sleep $delay
continue continue
fi fi
current_commit=`git rev-parse HEAD`
latest_commit=`git log "--format=%G? %H" origin/master | grep ^G | head -n 1 | cut -d' ' -f2` latest_commit=`git log "--format=%G? %H" origin/master | grep ^G | head -n 1 | cut -d' ' -f2`
if test -z $latest_commit; then if test -z $latest_commit; then
echo "Latest commit couldn't be found."
sleep $delay sleep $delay
continue continue
fi fi
git reset --hard >> $log 2>&1 git reset --hard
git checkout $latest_commit -f >> $log 2>&1 git checkout $latest_commit -f
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Git checkout failed. For more details, see $log" echo "Git checkout failed."
sleep $delay sleep $delay
continue continue
fi fi