feature: Added warning for modified working directories

This commit is contained in:
Torben Brenner 2022-11-04 15:54:08 +01:00
parent 9b3acb4899
commit ebc1b87dc2
1 changed files with 5 additions and 0 deletions

View File

@ -51,6 +51,11 @@ for DIR in /etc/bridgehead $(pwd); do
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
report_error 1 "Unable to update git $DIR: $OUT" report_error 1 "Unable to update git $DIR: $OUT"
fi fi
OUT="$(git -C $DIR status --porcelain)"
if [ -n "$OUT" ]; then
report_error 1 "The workingdirectory in $DIR is modified. Following files are changed: $OUT"
fi
new_git_hash="$(git -C $DIR rev-parse --verify HEAD)" new_git_hash="$(git -C $DIR rev-parse --verify HEAD)"
if [ "$old_git_hash" != "$new_git_hash" ]; then if [ "$old_git_hash" != "$new_git_hash" ]; then
CHANGE="Updated git repository in ${DIR} from commit $old_git_hash to $new_git_hash" CHANGE="Updated git repository in ${DIR} from commit $old_git_hash to $new_git_hash"