From: Kefu Chai Date: Mon, 20 Dec 2021 13:30:57 +0000 (+0800) Subject: ceph-pr-submodules: print out the changed submodule only X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=12e7ed7689ad55350ea6c15149f008ee903fa797;p=ceph-build.git ceph-pr-submodules: print out the changed submodule only 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 --- diff --git a/ceph-pr-submodules/build/build b/ceph-pr-submodules/build/build index 339dcb18..ea0edff3 100644 --- a/ceph-pr-submodules/build/build +++ b/ceph-pr-submodules/build/build @@ -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