Removing commit notes if push failed in tools/push.sh
This commit is contained in:
+33
-11
@@ -22,14 +22,6 @@ VERA_INFO="Vera++ "`vera++ --version`
|
|||||||
GCC_INFO=`gcc --version | head -n 1`
|
GCC_INFO=`gcc --version | head -n 1`
|
||||||
BUILD_INFO=`echo -e "$CPPCHECK_INFO\n$VERA_INFO\n$GCC_INFO"`
|
BUILD_INFO=`echo -e "$CPPCHECK_INFO\n$VERA_INFO\n$GCC_INFO"`
|
||||||
|
|
||||||
trap ctrl_c INT
|
|
||||||
|
|
||||||
function ctrl_c() {
|
|
||||||
git checkout master >&/dev/null
|
|
||||||
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
clear
|
clear
|
||||||
|
|
||||||
if [ "`git status --porcelain 2>&1 | wc -l`" != "0" ]
|
if [ "`git status --porcelain 2>&1 | wc -l`" != "0" ]
|
||||||
@@ -52,7 +44,7 @@ fi
|
|||||||
|
|
||||||
commits_to_push=`git log origin/master..master | grep "^commit [0-9a-f]*$" | awk 'BEGIN { s = ""; } { s = $2" "s; } END { print s; }'`
|
commits_to_push=`git log origin/master..master | grep "^commit [0-9a-f]*$" | awk 'BEGIN { s = ""; } { s = $2" "s; } END { print s; }'`
|
||||||
|
|
||||||
echo $commits_to_push | grep "[^ ]" >& /dev/null
|
echo $commits_to_push | grep "[^ ]" >&/dev/null
|
||||||
status_code=$?
|
status_code=$?
|
||||||
if [ $status_code -ne 0 ]
|
if [ $status_code -ne 0 ]
|
||||||
then
|
then
|
||||||
@@ -60,6 +52,20 @@ then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
trap ctrl_c INT
|
||||||
|
|
||||||
|
function ctrl_c() {
|
||||||
|
git checkout master >&/dev/null
|
||||||
|
|
||||||
|
for commit_hash in $commits_to_push
|
||||||
|
do
|
||||||
|
git notes --ref=test_build_env remove $commit_hash
|
||||||
|
git notes --ref=perf remove $commit_hash
|
||||||
|
git notes --ref=mem remove $commit_hash
|
||||||
|
done
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "===== Starting pre-push commit testing series ====="
|
echo "===== Starting pre-push commit testing series ====="
|
||||||
echo
|
echo
|
||||||
@@ -131,8 +137,24 @@ then
|
|||||||
echo
|
echo
|
||||||
|
|
||||||
git push && echo -e "\n\e[0;32m Pushed successfully\e[0m\n" || echo -e "\n\e[1;33m Push failed\e[0m"
|
git push && echo -e "\n\e[0;32m Pushed successfully\e[0m\n" || echo -e "\n\e[1;33m Push failed\e[0m"
|
||||||
git push origin refs/notes/* || echo -e "\n\e[1;33m Notes push failed\e[0m"
|
status_code=$?
|
||||||
exit 0
|
|
||||||
|
if [ $status_code -eq 0 ]
|
||||||
|
then
|
||||||
|
git push origin refs/notes/* || echo -e "\n\e[1;33m Notes push failed\e[0m"
|
||||||
|
status_code=$?
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $status_code -ne 0 ]
|
||||||
|
then
|
||||||
|
for commit_hash in $commits_to_push
|
||||||
|
do
|
||||||
|
git notes --ref=test_build_env remove $commit_hash
|
||||||
|
git notes --ref=perf remove $commit_hash
|
||||||
|
git notes --ref=mem remove $commit_hash
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
exit $status_code
|
||||||
else
|
else
|
||||||
echo -e "\e[1;33m $GIT_STATUS_NOT_CLEAN_MSG. $GIT_STATUS_CONSIDER_CLEAN_MSG.\e[0m\n"
|
echo -e "\e[1;33m $GIT_STATUS_NOT_CLEAN_MSG. $GIT_STATUS_CONSIDER_CLEAN_MSG.\e[0m\n"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user