Grab latest commit
This commit is contained in:
parent
ae48e33b42
commit
18f4440487
12
run.sh
12
run.sh
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user