Move warning up

This commit is contained in:
Martin Lablans 2022-11-04 16:12:08 +01:00
parent ebc1b87dc2
commit 8c18426d28
1 changed files with 5 additions and 4 deletions

View File

@ -36,6 +36,11 @@ CHANGES=""
git_updated="false" git_updated="false"
for DIR in /etc/bridgehead $(pwd); do for DIR in /etc/bridgehead $(pwd); do
log "INFO" "Checking for updates to git repo $DIR ..." log "INFO" "Checking for updates to git repo $DIR ..."
OUT="$(git -C $DIR status --porcelain)"
if [ -n "$OUT" ]; then
log WARN "The working directory $DIR is modified. Changed files: $OUT"
report_error 1 "The working directory $DIR is modified. Changed files: $OUT"
fi
if [ "$(git -C $DIR config --get credential.helper)" != "$CREDHELPER" ]; then if [ "$(git -C $DIR config --get credential.helper)" != "$CREDHELPER" ]; then
log "INFO" "Configuring repo to use bridgehead git credential helper." log "INFO" "Configuring repo to use bridgehead git credential helper."
git -C $DIR config credential.helper "$CREDHELPER" git -C $DIR config credential.helper "$CREDHELPER"
@ -51,10 +56,6 @@ 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