From: Daniel P. Berrangé Date: Tue, 26 Apr 2022 13:06:49 +0000 (+0100) Subject: scripts: check if .git exists before checking submodule status X-Git-Tag: v7.2.0-rc0~33^2~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dd84a906e061550daaedea6ce88762f1839253ab;p=thirdparty%2Fqemu.git scripts: check if .git exists before checking submodule status Currently we check status of each submodule, before actually checking if we're in a git repo. These status commands will all fail, but we are hiding their output so we don't see it currently. Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- diff --git a/scripts/git-submodule.sh b/scripts/git-submodule.sh index e225d3a9634..7be41f59483 100755 --- a/scripts/git-submodule.sh +++ b/scripts/git-submodule.sh @@ -51,6 +51,12 @@ validate_error() { exit 1 } +if test -n "$maybe_modules" && ! test -e ".git" +then + echo "$0: unexpectedly called with submodules but no git checkout exists" + exit 1 +fi + modules="" for m in $maybe_modules do @@ -63,12 +69,6 @@ do fi done -if test -n "$maybe_modules" && ! test -e ".git" -then - echo "$0: unexpectedly called with submodules but no git checkout exists" - exit 1 -fi - case "$command" in status|validate) if test -z "$maybe_modules"