Commit graph

10 commits

Author SHA1 Message Date
Junio C Hamano 49ac7358da 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
2015-06-24 12:21:45 -07:00
Junio C Hamano ef45bb1f81 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>
2015-06-04 15:36:32 -07:00
Jeff King e6821d09e4 t: fix some trivial cases of ignored exit codes in loops
These are all cases where we do a setup step of the form:

  for i in $foo; do
	  set_up $i || break
  done &&
  more_setup

would not notice a failure in set_up (because break always
returns a 0 exit code). These are just setup steps that we
do not expect to fail, but it does not hurt to be defensive.

Most can be fixed by converting the "break" to a "return 1"
(since we eval our tests inside a function for just this
purpose). A few of the loops are inside subshells, so we can
use just "exit 1" to break out of the subshell. And a few
can actually be made shorter by just unrolling the loop.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-03-25 10:25:27 -07:00
Junio C Hamano 4c734803cb conflict-marker-size: add test and docs
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-20 23:49:27 -08:00
Shawn O. Pearce ed520a8f27 Merge branch 'mv/merge-recursive'
* mv/merge-recursive:
  builtin-merge: release the lockfile in try_merge_strategy()
  merge-recursive: get rid of virtual_id
  merge-recursive: move current_{file,directory}_set to struct merge_options
  merge-recursive: move the global obuf to struct merge_options
  merge-recursive: get rid of the index_only global variable
  merge-recursive: move call_depth to struct merge_options
  cherry-pick/revert: make direct internal call to merge_tree()
  builtin-merge: avoid run_command_v_opt() for recursive and subtree
  merge-recursive: introduce merge_options
  merge-recursive.c: Add more generic merge_recursive_generic()
  Split out merge_recursive() to merge-recursive.c
2008-09-25 09:49:19 -07:00
Miklos Vajna 4271666046 builtin-merge: release the lockfile in try_merge_strategy()
Once we committed the locked index, we should release the lockfile. In
most cases this is done automatically when the process ends, but this is
not true in this case.

[jc: with additional tests from Eric Raible]

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-09-06 19:49:51 -07:00
Nanako Shiraishi 3604e7c5c6 tests: use "git xyzzy" form (t3600 - t6999)
Converts tests between t3600-t6300.

Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-09-03 14:13:59 -07:00
Junio C Hamano 153920da5b Custom low-level merge driver: change the configuration scheme.
This changes the configuration syntax for defining a low-level
merge driver to be:

	[merge "<<drivername>>"]
		driver = "<<command line>>"
		name = "<<driver description>>"

which is much nicer to read and is extensible.  Credit goes to
Martin Waitz and Linus.

In addition, when we use an external low-level merge driver, it
is reported as an extra output from merge-recursive, using the
value of merge.<<drivername>.name variable.

The demonstration in t6026 has also been updated.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-18 12:30:26 -07:00
Junio C Hamano f3ef6b6bbe Custom low-level merge driver support.
This allows users to specify custom low-level merge driver per
path, using the attributes mechanism.  Just like you can specify
one of built-in "text", "binary", "union" low-level merge
drivers by saying:

	*		merge=text
	.gitignore	merge=union
	*.jpg		merge=binary

pick a name of your favorite merge driver, and assign it as the
value of the 'merge' attribute.

A custom low-level merge driver is defined via the config
mechanism.  This patch introduces 'merge.driver', a multi-valued
configuration.  Its value is the name (i.e. the one you use as
the value of 'merge' attribute) followed by a command line
specification.  The command line can contain %O, %A, and %B to
be interpolated with the names of temporary files that hold the
common ancestor version, the version from your branch, and the
version from the other branch, and the resulting command is
spawned.

The low-level merge driver is expected to update the temporary
file for your branch (i.e. %A) with the result and exit with
status 0 for a clean merge, and non-zero status for a conflicted
merge.

A new test in t6026 demonstrates a sample usage.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-18 01:43:42 -07:00
Junio C Hamano 47579efc00 Add a demonstration/test of customized merge.
This demonstrates how the new low-level per-path merge backends,
union and ours, work, and shows how they are controlled by the
gitattribute mechanism.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-17 14:21:22 -07:00