Skip to content

Commit

Permalink
Rename "strategy" to "git_strategy"
Browse files Browse the repository at this point in the history
  • Loading branch information
mernst authored Sep 2, 2024
1 parent b9539a3 commit eaa9c11
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 24 deletions.
16 changes: 8 additions & 8 deletions src/scripts/merge_tools/gitmerge.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
#!/usr/bin/env sh

# usage: ./gitmerge.sh <clone_dir> <branch-1> <branch-2> <strategy>
# usage: ./gitmerge.sh <clone_dir> <branch-1> <branch-2> <git_strategy>
# <clone_dir> must contain a clone of a repository.
# <strategy> is arguments to `git merge`, including -s and possibly -X.
# Merges branch2 into branch1, in <clone_dir>, using merge strategy <strategy>.
# <git_strategy> is arguments to `git merge`, including -s and possibly -X.
# Merges branch2 into branch1, in <clone_dir>, using merge strategy <git_strategy>.
# Return code is 0 for merge success, 1 for merge failure.
# For merge failure, also outputs "Conflict" and aborts the merge.

set -o nounset

if [ "$#" -ne 4 ]; then
echo "Usage: $0 CLONE_DIR BRANCH1 BRANCH2 STRATEGY" >&2
echo "Usage: $0 CLONE_DIR BRANCH1 BRANCH2 GIT_STRATEGY" >&2
exit 1
fi

clone_dir=$1
branch1=$2
branch2=$3
strategy=$4
git_strategy=$4

## Perform merge

Expand All @@ -26,14 +26,14 @@ cd "$clone_dir" || (echo "$0: cannot cd to $clone_dir" ; exit 1)
git checkout "$branch1" --force
git config merge.conflictstyle zdiff3

echo "Running: git merge --no-edit $strategy $branch2"
echo "Running: git merge --no-edit $git_strategy $branch2"
# shellcheck disable=SC2086
git merge --no-edit $strategy "$branch2"
git merge --no-edit $git_strategy "$branch2"
retVal=$?

# report conflicts
if [ $retVal -ne 0 ]; then
echo "gitmerge.sh: Conflict after running: git merge --no-edit $strategy $branch2"
echo "gitmerge.sh: Conflict after running: git merge --no-edit $git_strategy $branch2"
fi

exit $retVal
4 changes: 2 additions & 2 deletions src/scripts/merge_tools/gitmerge_ort.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ MERGE_SCRIPTS_DIR="$(cd "$(dirname "$0")" && pwd -P)"
clone_dir=$1
branch1=$2
branch2=$3
strategy="-s ort"
"$MERGE_SCRIPTS_DIR"/gitmerge.sh "$clone_dir" "$branch1" "$branch2" "$strategy"
git_strategy="-s ort"
"$MERGE_SCRIPTS_DIR"/gitmerge.sh "$clone_dir" "$branch1" "$branch2" "$git_strategy"
4 changes: 2 additions & 2 deletions src/scripts/merge_tools/gitmerge_ort_ignorespace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ MERGE_SCRIPTS_DIR="$(cd "$(dirname "$0")" && pwd -P)"
clone_dir=$1
branch1=$2
branch2=$3
strategy="-s ort -Xignore-space-change"
"$MERGE_SCRIPTS_DIR"/gitmerge.sh "$clone_dir" "$branch1" "$branch2" "$strategy"
git_strategy="-s ort -Xignore-space-change"
"$MERGE_SCRIPTS_DIR"/gitmerge.sh "$clone_dir" "$branch1" "$branch2" "$git_strategy"
4 changes: 2 additions & 2 deletions src/scripts/merge_tools/gitmerge_recursive_histogram.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ MERGE_SCRIPTS_DIR="$(cd "$(dirname "$0")" && pwd -P)"
clone_dir=$1
branch1=$2
branch2=$3
strategy="-s recursive -Xdiff-algorithm=histogram"
"$MERGE_SCRIPTS_DIR"/gitmerge.sh "$clone_dir" "$branch1" "$branch2" "$strategy"
git_strategy="-s recursive -Xdiff-algorithm=histogram"
"$MERGE_SCRIPTS_DIR"/gitmerge.sh "$clone_dir" "$branch1" "$branch2" "$git_strategy"
4 changes: 2 additions & 2 deletions src/scripts/merge_tools/gitmerge_recursive_ignorespace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ MERGE_DIR="$(dirname "$0")"
clone_dir=$1
branch1=$2
branch2=$3
strategy="-s recursive -Xignore-space-change"
"$MERGE_DIR"/gitmerge.sh "$clone_dir" "$branch1" "$branch2" "$strategy"
git_strategy="-s recursive -Xignore-space-change"
"$MERGE_DIR"/gitmerge.sh "$clone_dir" "$branch1" "$branch2" "$git_strategy"
4 changes: 2 additions & 2 deletions src/scripts/merge_tools/gitmerge_recursive_minimal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ MERGE_SCRIPTS_DIR="$(cd "$(dirname "$0")" && pwd -P)"
clone_dir=$1
branch1=$2
branch2=$3
strategy="-s recursive -Xdiff-algorithm=minimal"
"$MERGE_SCRIPTS_DIR"/gitmerge.sh "$clone_dir" "$branch1" "$branch2" "$strategy"
git_strategy="-s recursive -Xdiff-algorithm=minimal"
"$MERGE_SCRIPTS_DIR"/gitmerge.sh "$clone_dir" "$branch1" "$branch2" "$git_strategy"
4 changes: 2 additions & 2 deletions src/scripts/merge_tools/gitmerge_recursive_myers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ MERGE_SCRIPTS_DIR="$(cd "$(dirname "$0")" && pwd -P)"
clone_dir=$1
branch1=$2
branch2=$3
strategy="-s recursive -Xdiff-algorithm=myers"
"$MERGE_SCRIPTS_DIR"/gitmerge.sh "$clone_dir" "$branch1" "$branch2" "$strategy"
git_strategy="-s recursive -Xdiff-algorithm=myers"
"$MERGE_SCRIPTS_DIR"/gitmerge.sh "$clone_dir" "$branch1" "$branch2" "$git_strategy"
4 changes: 2 additions & 2 deletions src/scripts/merge_tools/gitmerge_recursive_patience.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ MERGE_SCRIPTS_DIR="$(cd "$(dirname "$0")" && pwd -P)"
clone_dir=$1
branch1=$2
branch2=$3
strategy="-s recursive -Xdiff-algorithm=patience"
"$MERGE_SCRIPTS_DIR"/gitmerge.sh "$clone_dir" "$branch1" "$branch2" "$strategy"
git_strategy="-s recursive -Xdiff-algorithm=patience"
"$MERGE_SCRIPTS_DIR"/gitmerge.sh "$clone_dir" "$branch1" "$branch2" "$git_strategy"
4 changes: 2 additions & 2 deletions src/scripts/merge_tools/gitmerge_resolve.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ MERGE_SCRIPTS_DIR="$(cd "$(dirname "$0")" && pwd -P)"
clone_dir=$1
branch1=$2
branch2=$3
strategy="-s resolve"
"$MERGE_SCRIPTS_DIR"/gitmerge.sh "$clone_dir" "$branch1" "$branch2" "$strategy"
git_strategy="-s resolve"
"$MERGE_SCRIPTS_DIR"/gitmerge.sh "$clone_dir" "$branch1" "$branch2" "$git_strategy"
status=$?

if [ "$status" -ne 0 ]; then
Expand Down

0 comments on commit eaa9c11

Please sign in to comment.