From 383f352867b53331cc22cd1e0d8e23e4f380e6ae Mon Sep 17 00:00:00 2001 From: Dan Mick Date: Wed, 15 Mar 2017 22:06:20 -0700 Subject: [PATCH] ceph-pr-submodules: fix submodule check. Prior code never generated any output at all. Fixes: http://tracker.ceph.com/issues/19244 Signed-off-by: Dan Mick --- ceph-pr-submodules/build/build | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ceph-pr-submodules/build/build b/ceph-pr-submodules/build/build index 9428aa61..d7081ae0 100644 --- a/ceph-pr-submodules/build/build +++ b/ceph-pr-submodules/build/build @@ -4,14 +4,14 @@ set -ex cd "$WORKSPACE" -# The command below has access to the variables $name, $path, $sha1 and $toplevel: -# $name is the name of the relevant submodule section in .gitmodules, $path is -# the name of the submodule directory relative to the superproject, $sha1 is -# the commit as recorded in the superproject, and $toplevel is the absolute -# path to the top-level of the superproject. -modified_submodules=$(git submodule foreach 'cd $toplevel; git diff --ignore-submodules=dirty origin/master -- $path') +# show diffs between $ghprbTargetBranch (where the merge is going) and +# $ghprbActualCommit (the tip of the branch that's merging) with '...', +# which is equivalent to diff $(git merge-base TB AC) AC, or "show +# 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/$ghprbTargetBranch...$ghprbActualCommit | grep ^Submodule || true)" -if [[ $modified_submodules ]]; then +if [[ -n "$modified_submodules" ]]; then echo "Project has modified submodules!" echo $modified_submodules exit 1 -- 2.39.5