From: Junio C Hamano Date: Wed, 24 Jun 2015 19:21:45 +0000 (-0700) Subject: Merge branch 'jc/ll-merge-expose-path' X-Git-Tag: v2.5.0-rc0~22 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/49ac7358da163b0f8a32ce71723b2071f962d3fd?ds=inline;hp=-c Merge branch 'jc/ll-merge-expose-path' Traditionally, external low-level 3-way merge drivers are expected to produce their results based solely on the contents of the three variants given in temporary files named by %O, %A and %B on their command line. Additionally allow them to look at the final path (given by %P). * jc/ll-merge-expose-path: ll-merge: pass the original path to external drivers --- 49ac7358da163b0f8a32ce71723b2071f962d3fd diff --combined Documentation/gitattributes.txt index 70899b3023,3de7195bc2..81fe586948 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@@ -80,7 -80,7 +80,7 @@@ Attributes which should be version-cont repositories (i.e., attributes of interest to all users) should go into `.gitattributes` files. Attributes that should affect all repositories for a single user should be placed in a file specified by the -`core.attributesfile` configuration option (see linkgit:git-config[1]). +`core.attributesFile` configuration option (see linkgit:git-config[1]). Its default value is $XDG_CONFIG_HOME/git/attributes. If $XDG_CONFIG_HOME is either not set or empty, $HOME/.config/git/attributes is used instead. Attributes for all users on a system should be placed in the @@@ -774,7 -774,7 +774,7 @@@ To define a custom merge driver `filfre ---------------------------------------------------------------- [merge "filfre"] name = feel-free merge driver - driver = filfre %O %A %B + driver = filfre %O %A %B %L %P recursive = binary ---------------------------------------------------------------- @@@ -800,6 -800,9 +800,9 @@@ merge between common ancestors, when th When left unspecified, the driver itself is used for both internal merge and the final merge. + The merge driver can learn the pathname in which the merged result + will be stored via placeholder `%P`. + `conflict-marker-size` ^^^^^^^^^^^^^^^^^^^^^^ diff --combined t/t6026-merge-attr.sh index 3c21938a68,e38ebe8bbc..04c0509c47 --- a/t/t6026-merge-attr.sh +++ b/t/t6026-merge-attr.sh @@@ -11,7 -11,7 +11,7 @@@ test_expect_success setup for f in text binary union do - echo Initial >$f && git add $f || break + echo Initial >$f && git add $f || return 1 done && test_tick && git commit -m Initial && @@@ -19,7 -19,7 +19,7 @@@ git branch side && for f in text binary union do - echo Master >>$f && git add $f || break + echo Master >>$f && git add $f || return 1 done && test_tick && git commit -m Master && @@@ -27,7 -27,7 +27,7 @@@ git checkout side && for f in text binary union do - echo Side >>$f && git add $f || break + echo Side >>$f && git add $f || return 1 done && test_tick && git commit -m Side && @@@ -85,11 -85,12 +85,12 @@@ test_expect_success 'retry the merge wi 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 +111,7 @@@ test_expect_success 'custom merge backe 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 +122,7 @@@ 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 +132,7 @@@ test_expect_success 'custom merge backe 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 +149,12 @@@ 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 '