mirror of
https://github.com/lcn2/calc.git
synced 2025-08-16 01:03:29 +03:00
add git checks for staged and unstaged changes
This commit is contained in:
23
chk_tree
23
chk_tree
@@ -142,6 +142,25 @@ if [[ -d .git ]]; then
|
||||
EXIT_CODE=13
|
||||
echo "$0: Warning: set EXIT_CODE: $EXIT_CODE" 1>&2
|
||||
fi
|
||||
|
||||
# verify that there are no uncommitted changes under git
|
||||
#
|
||||
GIT_STATUS=$(git status --untracked-files=no --porcelain 2>&1)
|
||||
if [[ -n $GIT_STATUS ]] || ! diff --quiet --exit-code; then
|
||||
echo "$0: ERROR: there are unstaged changes" 1>&2
|
||||
git status --untracked-files=no --porcelain --short
|
||||
EXIT_CODE=14
|
||||
echo "$0: Warning: set EXIT_CODE: $EXIT_CODE" 1>&2
|
||||
fi
|
||||
|
||||
# verify that there are no staged uncommitted changes under git
|
||||
#
|
||||
if ! git diff --cached --quiet --exit-code; then
|
||||
echo "$0: ERROR: there are staged uncommitted changes" 1>&2
|
||||
git status --short
|
||||
EXIT_CODE=15
|
||||
echo "$0: Warning: set EXIT_CODE: $EXIT_CODE" 1>&2
|
||||
fi
|
||||
fi
|
||||
|
||||
# collect make buildlist file list
|
||||
@@ -173,7 +192,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=14
|
||||
EXIT_CODE=16
|
||||
echo "$0: Warning: set EXIT_CODE: $EXIT_CODE" 1>&2
|
||||
fi
|
||||
|
||||
@@ -231,7 +250,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=15
|
||||
EXIT_CODE=16
|
||||
echo "$0: Warning: set EXIT_CODE: $EXIT_CODE" 1>&2
|
||||
fi
|
||||
|
||||
|
Reference in New Issue
Block a user