git: Make submodule check only needed modules
authorJuan Quintela <quintela@redhat.com>
Wed, 29 Jan 2020 10:21:13 +0000 (11:21 +0100)
committerJuan Quintela <quintela@redhat.com>
Thu, 13 Feb 2020 10:31:58 +0000 (11:31 +0100)
If one is compiling more than one tree from the same source, it is
possible that they need different submodules.  Change the check to see
that all modules that we are interested in are updated, discarding the
ones that we don't care about.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---

v1->v2:
patchw insists in not using modules

scripts/git-submodule.sh

index 98ca0f2737abdb8aa10d3c4d14e169877c16babd..65ed877aefd9837cefb8a4b2328b092f8c58bf99 100755 (executable)
@@ -59,10 +59,14 @@ status)
     fi
 
     test -f "$substat" || exit 1
-    CURSTATUS=$($GIT submodule status $modules)
-    OLDSTATUS=$(cat $substat)
-    test "$CURSTATUS" = "$OLDSTATUS"
-    exit $?
+    for module in $modules; do
+        CURSTATUS=$($GIT submodule status $module)
+        OLDSTATUS=$(cat $substat | grep $module)
+        if test "$CURSTATUS" != "$OLDSTATUS"; then
+            exit 1
+        fi
+    done
+    exit 0
     ;;
 update)
     if test -z "$maybe_modules"