Skip to content

Commit

Permalink
Add diagnostics
Browse files Browse the repository at this point in the history
  • Loading branch information
mernst committed Sep 21, 2024
1 parent 5bed1e8 commit c854fa8
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/scripts/merge_tools/gitmerge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
19 changes: 19 additions & 0 deletions src/scripts/merge_tools/merge_git_then_plumelib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c854fa8

Please sign in to comment.