]> git.apps.os.sepia.ceph.com Git - ceph-build.git/commitdiff
ceph-pr-submodules: print out the changed submodule only
authorKefu Chai <tchaikov@gmail.com>
Mon, 20 Dec 2021 13:30:57 +0000 (21:30 +0800)
committerKefu Chai <tchaikov@gmail.com>
Mon, 20 Dec 2021 13:49:45 +0000 (21:49 +0800)
instead of printing:

Project has modified submodules!
Submodule src/seastar f021c161816...ce2652d39dc (commits not present)

just print:

Project has modified submodules: src/seastar

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
ceph-pr-submodules/build/build

index 339dcb187bbdf08651b63f832b8097853dc63f71..ea0edff3c188b5232e54739f7378279277c986cc 100644 (file)
@@ -22,12 +22,16 @@ function has_modified_submodules() {
     # diff from common ancestor of the target branch and this branch with the
     # tip of this branch".  With --submodule, also show detail of diff in submodules.
     modified_submodules="$(git diff --submodule=log origin/${target_branch}...${actual_commit} | grep ^Submodule || true)"
-    test -n "${modified_submodules}"
+    if test -n "${modified_submodules}"; then
+        modified_submodules=$(echo $modified_submodules | awk '{print $2}')
+        return 0
+    else
+        return 1
+    fi
 }
 
 if has_modified_submodules "${ghprbTargetBranch}" "${ghprbActualCommit}"; then
-    echo "Project has modified submodules!"
-    echo $modified_submodules
+    echo "Project has modified submodules: $modified_submodules !"
     exit 1
 fi