Skip to content

Custom low-level merge driver support.

Junio C Hamano git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 19 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2Custom low-level merge driver support.merge-recursive.c t/t6026-merge-attr.sh+235 -132 replies
2/2Allow the default low-level merge driver to be configured.merge-recursive.c+12 -20 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] Custom low-level merge driver support.

This two-patch series concludes my initial attempt for gitattributes for now.

It hooks into the merge-recursive backend to allow custom low-level 3-way merge drivers to be specified path-by-path basis.

To define a custom low-level merge driver, the usual configuration mechanism is used.

	[merge]
		driver = ancient merge %A %O %B

The new configuration item, 'merge.driver', is multi-valued. Each of its values begin with the name of the low-level driver ('ancient' in the above example), followed by its command line. The command line can contain the following patterns to be processed with the usual interpolation mechanism:

%O name of the temporary file that has the
ancestor's version.

%A name of the temporary file that has the
version from the current branch.

%B name of the temporary file that has the
version from the other branch.

The low-level driver is expected to update the file named with %A with the result of the merge, and exit with zero status upon a clean merge. It can exit with non-zero status to signal that the result still has conflicts.

Once you set up a low-level merge driver, you can specify that driver to be used for specific paths, using the attributes mechanism, by using the driver's name as the value of 'merge' attribute. For example, taken together with the above 'ancient' driver configuration and this line in your .git/info/attributes:

*.txt merge=ancient

will use the old "RCS merge" external program to merge a file whose extension is ".txt", just like we used to do before v1.5.0.