Skip to content

Commit

Permalink
Clean up diffs between scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
mernst committed Sep 23, 2024
1 parent 170cca7 commit f609302
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 9 deletions.
16 changes: 10 additions & 6 deletions src/scripts/merge_tools/check-implementations.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@

set -e

SCRIPTDIR="$(cd "$(dirname "$0")" && pwd -P)"

# Check for identical content.

cd "$SCRIPTDIR"

diff -q ivn_plus.sh adjacent_plus.sh > /dev/null 2>&1 && { echo "identical: ivn_plus.sh adjacent_plus.sh"; exit 1; }
diff -q ivn_plus.sh gitmerge_ort_plus.sh
diff -q ivn_plus.sh imports_plus.sh
Expand All @@ -26,25 +30,25 @@ tmpfile2=$(mktemp)

for base in adjacent imports ivn version_numbers ; do
diff "$base.sh" "${base}_ignorespace.sh" > "$tmpfile" || true
diff -q diff-pl-ignorespace.diff "$tmpfile" || { echo "problem with: diff $base.sh ${base}_ignorespace.sh" ; exit 1; }
diff -q diff-pl-ignorespace.diff "$tmpfile" || { echo "problem with: diff $base.sh ${base}_ignorespace.sh, expected to be as in diff-pl-ignorespace.diff" ; exit 1; }
diff "${base}_plus.sh" "${base}_ignorespace_plus.sh" > "$tmpfile" || true
diff -q diff-pl-ignorespace.diff "$tmpfile" || { echo "problem with: diff ${base}_plus.sh ${base}_ignorespace_plus.sh" ; exit 1; }
diff -q diff-pl-ignorespace.diff "$tmpfile" || { echo "problem with: diff ${base}_plus.sh ${base}_ignorespace_plus.sh, expected to be as in diff-pl-ignorespace.diff" ; exit 1; }

diff "$base.sh" "${base}_plus.sh" > "$tmpfile" || true
diff "${base}_ignorespace.sh" "${base}_ignorespace_plus.sh" > "$tmpfile2" || true
diff -q "$tmpfile" "$tmpfile2" || { echo "problem with: ( $base.sh ${base}_plus.sh) versus ( ${base}_ignorespace.sh ${base}_ignorespace_plus.sh"; exit 1; }
diff -q "$tmpfile" "$tmpfile2" || { echo "problem with: ( $base.sh ${base}_plus .sh) versus ( ${base}_ignorespace.sh ${base}_ignorespace_plus.sh )"; exit 1; }
done


for base in gitmerge_ort gitmerge_recursive_myers ; do
diff "$base.sh" "${base}_ignorespace.sh" > "$tmpfile" || true
diff "${base}_plus.sh" "${base}_ignorespace_plus.sh" > "$tmpfile2" || true
diff -q "$tmpfile" "$tmpfile2" || { echo "problem with: ( $base.sh ${base}_ignorespace.sh) versus ( ${base}_plus.sh ${base}_ignorespace_plus.sh"; exit 1; }
diff -q "$tmpfile" "$tmpfile2" || { echo "problem with: ( $base.sh ${base}_ignorespace.sh ) versus ( ${base}_plus.sh ${base}_ignorespace_plus.sh )"; exit 1; }


diff "$base.sh" "${base}_plus.sh" > "$tmpfile" || true
diff "${base}_ignorespace.sh" "${base}_ignorespace_plus.sh" > "$tmpfile2" || true
diff -q "$tmpfile" "$tmpfile2" || { echo "problem with: ( $base.sh ${base}_plus.sh) versus ( ${base}_ignorespace.sh ${base}_ignorespace_plus.sh"; exit 1; }
diff -q "$tmpfile" "$tmpfile2" || { echo "problem with: ( $base.sh ${base}_plus.sh ) versus ( ${base}_ignorespace.sh ${base}_ignorespace_plus.sh )"; exit 1; }
done


Expand All @@ -56,7 +60,7 @@ for base in gitmerge_recursive_histogram gitmerge_recursive_minimal \
gitmerge_recursive_patience ; do

diff "$base.sh" "${base}_plus.sh" > "$tmpfile" || true
diff -q diff-gm-plus.diff "$tmpfile" || { echo "problem with $base.sh ${base}_plus.sh"; exit 1; }
diff -q diff-gm-plus.diff "$tmpfile" || { echo "problem with $base.sh ${base}_plus.sh, expected to be as in diff-gm-plus.diff"; exit 1; }

done

Expand Down
9 changes: 7 additions & 2 deletions src/scripts/merge_tools/diff-gm-plus.diff
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
10c10,11
6a7
> verbose=
7a9
> verbose="$1"
15c17,19
< "$MERGE_SCRIPTS_DIR"/gitmerge.sh "$clone_dir" "$branch1" "$branch2" "$git_strategy"
---
> plumelib_strategy=""
> "$MERGE_SCRIPTS_DIR"/merge_git_then_plumelib.sh "$clone_dir" "$branch1" "$branch2" "$git_strategy" "$plumelib_strategy"
> # shellcheck disable=SC2086 # '$verbose' should not be quoted
> "$MERGE_SCRIPTS_DIR"/merge_git_then_plumelib.sh $verbose "$clone_dir" "$branch1" "$branch2" "$git_strategy" "$plumelib_strategy"
2 changes: 1 addition & 1 deletion src/scripts/merge_tools/diff-pl-ignorespace.diff
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
9c9
16c16
< git_strategy="-s ort"
---
> git_strategy="-s ort -Xignore-space-change"
2 changes: 2 additions & 0 deletions src/scripts/merge_tools/gitmerge_ort.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

MERGE_SCRIPTS_DIR="$(cd "$(dirname "$0")" && pwd -P)"


if [ "$1" = "--verbose" ] ; then

shift
fi

Expand Down
2 changes: 2 additions & 0 deletions src/scripts/merge_tools/gitmerge_ort_ignorespace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

MERGE_SCRIPTS_DIR="$(cd "$(dirname "$0")" && pwd -P)"


if [ "$1" = "--verbose" ] ; then

shift
fi

Expand Down
2 changes: 2 additions & 0 deletions src/scripts/merge_tools/gitmerge_recursive_myers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

MERGE_SCRIPTS_DIR="$(cd "$(dirname "$0")" && pwd -P)"


if [ "$1" = "--verbose" ] ; then

shift
fi

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

MERGE_SCRIPTS_DIR="$(cd "$(dirname "$0")" && pwd -P)"


if [ "$1" = "--verbose" ] ; then

shift
fi

Expand Down

0 comments on commit f609302

Please sign in to comment.