Skip to contentSkip to conversation

scripts: check if .git exists before checking submodule status

PATCH In review Daniel P. Berrangé 3 participants 3 messages Jun 29, 2022 – Jul 6, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 scripts/git-submodule.sh | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
scripts/git-submodule.sh +6 -6
index e225d3a963..7be41f5948 100755
@@ -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"
Signature · 1 line
2.36.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Daniel P. Berrangé

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.

---
  scripts/git-submodule.sh | 12 ++++++------
  1 file changed, 6 insertions(+), 6 deletions(-)

r~

Reviewed-by Philippe Mathieu-Daudé on v1 1/1
#2 lore raw
In reply to Daniel P. Berrangé
Quoted 8 lines · Daniel P. Berrangé

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.

---
  scripts/git-submodule.sh | 12 ++++++------
  1 file changed, 6 insertions(+), 6 deletions(-)