From ebc1b87dc2b24e01dfac6c0e28ff2c996da82923 Mon Sep 17 00:00:00 2001 From: Torben Brenner Date: Fri, 4 Nov 2022 15:54:08 +0100 Subject: [PATCH] feature: Added warning for modified working directories --- lib/update-bridgehead.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/update-bridgehead.sh b/lib/update-bridgehead.sh index 636c585..a62f7fa 100755 --- a/lib/update-bridgehead.sh +++ b/lib/update-bridgehead.sh @@ -51,6 +51,11 @@ for DIR in /etc/bridgehead $(pwd); do if [ $? -ne 0 ]; then report_error 1 "Unable to update git $DIR: $OUT" 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)" if [ "$old_git_hash" != "$new_git_hash" ]; then CHANGE="Updated git repository in ${DIR} from commit $old_git_hash to $new_git_hash"