From 12e7ed7689ad55350ea6c15149f008ee903fa797 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Mon, 20 Dec 2021 21:30:57 +0800 Subject: [PATCH] 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 --- ceph-pr-submodules/build/build | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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 -- 2.39.5