summaryrefslogtreecommitdiff
path: root/t/t6026-merge-attr.sh
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2015-06-04 15:10:29 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2015-06-04 15:36:32 -0700
commitef45bb1f8156030446658d5bfb3983ce214a9e16 (patch)
tree7f975d0ae99e0b6d6482e26db55b92db988a557c /t/t6026-merge-attr.sh
parentGit 2.2.2 (diff)
downloadtgif-ef45bb1f8156030446658d5bfb3983ce214a9e16.tar.xz
ll-merge: pass the original path to external drivers
The interface to custom low-level merge driver was modeled to be capable of driving programs like "merge" (from the RCS suite) that can produce result solely by looking at three files that hold contents of common ancestor, ours and theirs. The information we feed to the external drivers via the command line placeholders %O, %A, and %B were designed to be purely about contents by giving names of the temporary files that hold these variants without exposing the original pathname. No matter where the result goes, merging the same three variants should produce the same result, contents is the king, that is the Git way. The external driver interface, however, is meant to help people to step outside the Git worldview, and sometimes people want to know the final path that the resulting merged contents would be stored in. Expose this to the external drivers via a new placeholder %P. Requested-by: Andreas Gondek Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t6026-merge-attr.sh')
-rwxr-xr-xt/t6026-merge-attr.sh14
1 files changed, 9 insertions, 5 deletions
diff --git a/t/t6026-merge-attr.sh b/t/t6026-merge-attr.sh
index 5e439972be..e38ebe8bbc 100755
--- a/t/t6026-merge-attr.sh
+++ b/t/t6026-merge-attr.sh
@@ -85,11 +85,12 @@ test_expect_success 'retry the merge with longer context' '
cat >./custom-merge <<\EOF
#!/bin/sh
-orig="$1" ours="$2" theirs="$3" exit="$4"
+orig="$1" ours="$2" theirs="$3" exit="$4" path=$5
(
echo "orig is $orig"
echo "ours is $ours"
echo "theirs is $theirs"
+ echo "path is $path"
echo "=== orig ==="
cat "$orig"
echo "=== ours ==="
@@ -110,7 +111,7 @@ test_expect_success 'custom merge backend' '
git reset --hard anchor &&
git config --replace-all \
- merge.custom.driver "./custom-merge %O %A %B 0" &&
+ merge.custom.driver "./custom-merge %O %A %B 0 %P" &&
git config --replace-all \
merge.custom.name "custom merge driver for testing" &&
@@ -121,7 +122,7 @@ test_expect_success 'custom merge backend' '
o=$(git unpack-file master^:text) &&
a=$(git unpack-file side^:text) &&
b=$(git unpack-file master:text) &&
- sh -c "./custom-merge $o $a $b 0" &&
+ sh -c "./custom-merge $o $a $b 0 'text'" &&
sed -e 1,3d $a >check-2 &&
cmp check-1 check-2 &&
rm -f $o $a $b
@@ -131,7 +132,7 @@ test_expect_success 'custom merge backend' '
git reset --hard anchor &&
git config --replace-all \
- merge.custom.driver "./custom-merge %O %A %B 1" &&
+ merge.custom.driver "./custom-merge %O %A %B 1 %P" &&
git config --replace-all \
merge.custom.name "custom merge driver for testing" &&
@@ -148,9 +149,12 @@ test_expect_success 'custom merge backend' '
o=$(git unpack-file master^:text) &&
a=$(git unpack-file anchor:text) &&
b=$(git unpack-file master:text) &&
- sh -c "./custom-merge $o $a $b 0" &&
+ sh -c "./custom-merge $o $a $b 0 'text'" &&
sed -e 1,3d $a >check-2 &&
cmp check-1 check-2 &&
+ sed -e 1,3d -e 4q $a >check-3 &&
+ echo "path is text" >expect &&
+ cmp expect check-3 &&
rm -f $o $a $b
'