From c854fa868cbff10ce8aef6dff7a550be8860a844 Mon Sep 17 00:00:00 2001 From: Michael Ernst Date: Sat, 21 Sep 2024 09:45:39 -0700 Subject: [PATCH] Add diagnostics --- src/scripts/merge_tools/gitmerge.sh | 18 +++++++++++++++++- .../merge_tools/merge_git_then_plumelib.sh | 19 +++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/scripts/merge_tools/gitmerge.sh b/src/scripts/merge_tools/gitmerge.sh index ce27cc1161..bf373243f9 100755 --- a/src/scripts/merge_tools/gitmerge.sh +++ b/src/scripts/merge_tools/gitmerge.sh @@ -19,19 +19,35 @@ branch1=$2 branch2=$3 git_strategy=$4 +VERBOSE= +## Enable for debugging +# VERBOSE=YES + + ## Perform merge cd "$clone_dir" || { echo "$0: cannot cd to $clone_dir"; exit 2; } +if [ -n "$VERBOSE" ] ; then + echo "$0: about to run: git checkout $branch1 in $(pwd)" +fi git checkout "$branch1" --force +if [ -n "$VERBOSE" ] ; then + echo "$0: ran: git checkout $branch1 in $(pwd)" +fi git config --local merge.conflictstyle diff3 git config --local mergetool.prompt false -echo "Running: git merge --no-edit $git_strategy $branch2" +echo "$0: about to run: git merge --no-edit $git_strategy $branch2 in $(pwd)" + # shellcheck disable=SC2086 git merge --no-edit $git_strategy "$branch2" retVal=$? +if [ -n "$VERBOSE" ] ; then + echo "$0: ran: git merge --no-edit $git_strategy $branch2 in $(pwd)" +fi + # report conflicts if [ $retVal -ne 0 ]; then echo "gitmerge.sh: Conflict after running: git merge --no-edit $git_strategy $branch2" diff --git a/src/scripts/merge_tools/merge_git_then_plumelib.sh b/src/scripts/merge_tools/merge_git_then_plumelib.sh index c06a827be3..406d6f53ab 100755 --- a/src/scripts/merge_tools/merge_git_then_plumelib.sh +++ b/src/scripts/merge_tools/merge_git_then_plumelib.sh @@ -19,19 +19,38 @@ branch2=$3 git_strategy=$4 #"-Xignore-space-change" plumelib_strategy=$5 #"--only-adjacent" +VERBOSE= +## Enable for debugging +# VERBOSE=YES + + ## Perform merge echo "$0: Merging $branch1 and $branch2 with git_strategy=$git_strategy and plumelib_strategy=$plumelib_strategy" cd "$clone_dir" || { echo "$0: cannot cd to $clone_dir"; exit 2; } +if [ -n "$VERBOSE" ] ; then + echo "$0: about to run: git checkout $branch1 in $(pwd)" +fi git checkout "$branch1" --force +if [ -n "$VERBOSE" ] ; then + echo "$0: ran: git checkout $branch1 in $(pwd)" +fi git config --local merge.conflictstyle diff3 git config --local mergetool.prompt false +if [ -n "$VERBOSE" ] ; then + echo "$0: about to run: git merge --no-edit $git_strategy $branch2 in $(pwd)" +fi + # shellcheck disable=SC2086 git merge --no-edit $git_strategy "$branch2" +if [ -n "$VERBOSE" ] ; then + echo "$0: ran: git merge --no-edit $git_strategy $branch2 in $(pwd)" +fi + ## Now, run Plume-lib Merging to improve the result of `git merge`. git config --local merge.tool merge-plumelib