mirror of
https://github.com/lcn2/calc.git
synced 2025-08-19 01:13:27 +03:00
improve branch check for chk_tree
This commit is contained in:
22
chk_tree
22
chk_tree
@@ -166,21 +166,31 @@ if [[ -d .git ]]; then
|
||||
#
|
||||
GIT_MASTER=$(git rev-list --count master)
|
||||
GIT_ORIGIN_MASTER=$(git rev-list --count origin/master)
|
||||
if [[ $GIT_MASTER -ne $GIT_ORIGIN_MASTER ]]; then
|
||||
echo "$0: ERROR: master branch is ahead of origin/master" 1>&2
|
||||
if [[ $GIT_MASTER -lt $GIT_ORIGIN_MASTER ]]; then
|
||||
echo "$0: ERROR: master branch is behind of origin/master" 1>&2
|
||||
git status master
|
||||
EXIT_CODE=16
|
||||
echo "$0: Warning: set EXIT_CODE: $EXIT_CODE" 1>&2
|
||||
elif [[ $GIT_MASTER -gt $GIT_ORIGIN_MASTER ]]; then
|
||||
echo "$0: ERROR: master branch is ahead of origin/master" 1>&2
|
||||
git status master
|
||||
EXIT_CODE=17
|
||||
echo "$0: Warning: set EXIT_CODE: $EXIT_CODE" 1>&2
|
||||
fi
|
||||
|
||||
# verify that branch is not ahead of 'origin/HEAD'
|
||||
#
|
||||
GIT_HEAD=$(git rev-list --count HEAD)
|
||||
GIT_ORIGIN_HEAD=$(git rev-list --count origin/HEAD)
|
||||
if [[ $GIT_HEAD -ne $GIT_ORIGIN_HEAD ]]; then
|
||||
if [[ $GIT_HEAD -lt $GIT_ORIGIN_HEAD ]]; then
|
||||
echo "$0: ERROR: HEAD is behind of origin/HEAD" 1>&2
|
||||
git status HEAD
|
||||
EXIT_CODE=18
|
||||
echo "$0: Warning: set EXIT_CODE: $EXIT_CODE" 1>&2
|
||||
elif [[ $GIT_HEAD -gt $GIT_ORIGIN_HEAD ]]; then
|
||||
echo "$0: ERROR: HEAD is ahead of origin/HEAD" 1>&2
|
||||
git status HEAD
|
||||
EXIT_CODE=17
|
||||
EXIT_CODE=19
|
||||
echo "$0: Warning: set EXIT_CODE: $EXIT_CODE" 1>&2
|
||||
fi
|
||||
fi
|
||||
@@ -214,7 +224,7 @@ if [[ ${#DISTLIST_ALSO_IN_BUILDLIST[@]} -ne 0 ]]; then
|
||||
#
|
||||
echo "$0: ERROR: distlist files found in buildlist" 1>&2
|
||||
echo "$0: ERROR: distlist files found in buildlist: ${DISTLIST_ALSO_IN_BUILDLIST[*]}" 1>&2
|
||||
EXIT_CODE=18
|
||||
EXIT_CODE=20
|
||||
echo "$0: Warning: set EXIT_CODE: $EXIT_CODE" 1>&2
|
||||
fi
|
||||
|
||||
@@ -272,7 +282,7 @@ if [[ ${#UNKNOWN_FILE[@]} -ne 0 ]]; then
|
||||
#
|
||||
echo "$0: ERROR: files that are neither built nor distlist are found" 1>&2
|
||||
echo "$0: ERROR: distlist files found in buildlist: ${UNKNOWN_FILE[*]}" 1>&2
|
||||
EXIT_CODE=19
|
||||
EXIT_CODE=21
|
||||
echo "$0: Warning: set EXIT_CODE: $EXIT_CODE" 1>&2
|
||||
fi
|
||||
|
||||
|
Reference in New Issue
Block a user