Commit graph

30 commits

Author SHA1 Message Date
Charles Bailey 964473a042 Teach git mergetool to use custom commands defined at config time
Currently git mergetool is restricted to a set of commands defined
in the script. You can subvert the mergetool.<tool>.path to force
git mergetool to use a different command, but if you have a command
whose invocation syntax does not match one of the current tools then
you would have to write a wrapper script for it.

This patch adds two git config variable patterns which allow a more
flexible choice of merge tool.

If you run git mergetool with -t/--tool or the merge.tool config
variable set to an unrecognized tool then git mergetool will query the
mergetool.<tool>.cmd config variable. If this variable exists, then git
mergetool will treat the specified tool as a custom command and will use
a shell eval to run the command with the documented shell variables set.

mergetool.<tool>.trustExitCode can be used to indicate that the exit
code of the custom command can be used to determine the success of the
merge.

Signed-off-by: Charles Bailey <charles@hashpling.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-05 12:07:04 -08:00
Charles Bailey b3ea27e4de Changed an internal variable of mergetool to support custom commands
The variable $path changes to $MERGED so that it is more consistent
with $BASE, $LOCAL and $REMOTE for future custom command lines.

Signed-off-by: Charles Bailey <charles@hashpling.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-05 12:07:03 -08:00
Charles Bailey 44c36d1ccc Tidy up git mergetool's backup file behaviour
Currently a backup pre-merge file with conflict markers is sometimes
kept with a .orig extenstion and sometimes removed depending on the
particular merge tool used.

This patch makes the handling consistent across all merge tools and
configurable via a new mergetool.keepBackup config variable

Signed-off-by: Charles Bailey <charles@hashpling.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-05 12:07:03 -08:00
Rogan Dawes 2e8fd78195 Allow git-mergetool to handle paths with a leading space
Signed-off-by: Rogan Dawes <rogan@dawes.za.net>
2008-01-07 21:00:54 -08:00
Pini Reznik c3d51cd16a Open external merge tool with original file extensions for all three files
Before this change, conflicted files were open in external merge tool with
temporary filenames like REMOTE.$$ and LOCAL.$$.  This way meld was unable
to recognize these files and syntax highlighting feature was unusable.

Help such merge tools by giving temporar files the same extension as the
original.

Signed-off-by: Pini Reznik <pinir@expand.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-05 18:43:20 -08:00
Junio C Hamano 8f321a3925 scripts: Add placeholders for OPTIONS_SPEC
--text follows this line--
These commands currently lack OPTIONS_SPEC; allow people to
easily list with "git grep 'OPTIONS_SPEC=$'" what they can help
improving.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-06 01:50:02 -08:00
Steffen Prohaska d279fc1a76 mergetool: avoid misleading message "Resetting to default..."
If no mergetool is configured in the configuration variable
merge.tool the resetting message should not be printed.

This is fixed. The message is only printed if a tool is configured
but the entry in merge.tool is invalid.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-10-18 19:59:58 -04:00
Steffen Prohaska ca8e6b7a55 mergetool: add support for ECMerge
Add support to mergetool for ECMerge available from
http://www.elliecomputing.com/Products/merge_overview.asp

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-10-18 03:46:24 -04:00
Steffen Prohaska e3fa2c761f mergetool: use path to mergetool in config var mergetool.<tool>.path
This commit adds a mechanism to provide absolute paths to the
external programs called by 'git mergetool'. A path can be
specified in the configuation variable mergetool.<tool>.path.
The configuration variable is similar to how we name branches
and remotes. It is extensible if we need to specify more details
about a tool.

The mechanism is especially useful on Windows, where external
programs are unlikely to be in PATH.

[sp: Fixed a few minor issues prior to applying]

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-10-18 03:46:24 -04:00
Theodore Ts'o 208fe3ac7e mergetool: Fix typo in options passed to kdiff3
Fix missing double hyphens in "-L1" and "-L2"

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-09-28 22:26:05 -04:00
Theodore Ts'o f6e0e55934 mergetool: fix emerge when running in a subdirectory
Only pass the basename of the output filename when to emerge, since
emerge interprets non-absolute pathnames relative to the containing
directory of the output buffer.

Thanks to Kelvie Wong for pointing this out.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-09-28 21:23:22 -04:00
Junio C Hamano 769f39861b Mergetool generating blank files (1.5.3)
When mergetool is run from a subdirectory, "ls-files -u" nicely
limits the output to conflicted files in that directory, but
we need to give the full path to cat-file plumbing to grab the
contents of stages.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-09-28 20:13:14 -04:00
David Kastrup 822f7c7349 Supplant the "while case ... break ;; esac" idiom
A lot of shell scripts contained stuff starting with

	while case "$#" in 0) break ;; esac

and similar.  I consider breaking out of the condition instead of the
body od the loop ugly, and the implied "true" value of the
non-matching case is not really obvious to humans at first glance.  It
happens not to be obvious to some BSD shells, either, but that's
because they are not POSIX-compliant.  In most cases, this has been
replaced by a straight condition using "test".  "case" has the
advantage of being faster than "test" on vintage shells where "test"
is not a builtin.  Since none of them is likely to run the git
scripts, anyway, the added readability should be worth the change.

A few loops have had their termination condition expressed
differently.

Signed-off-by: David Kastrup <dak@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-23 16:12:00 -07:00
Junio C Hamano 5be60078c9 Rewrite "git-frotz" to "git frotz"
This uses the remove-dashes target to replace "git-frotz" to "git frotz".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-02 22:52:14 -07:00
Theodore Ts'o 301ac38b12 git-mergetool: Make default selection of merge-tool more intelligent
Make git-mergetool prefer meld under GNOME, and kdiff3 under KDE.  When
considering emerge and vimdiff, check $VISUAL and $EDITOR to see which the
user might prefer.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: Josh Triplett <josh@freedesktop.org>
2007-06-10 11:17:30 -04:00
Dan McGee 730b5b45fb [PATCH] git-mergetool: Allow gvimdiff to be used as a mergetool
Signed-off-by: Dan McGee <dpmcgee@gmail.com>
Acked-by: "Theodore Ts'o" <tytso@mit.edu>
2007-06-10 08:27:29 -04:00
Josh Triplett 2571ac6722 Fix typo in git-mergetool
Signed-off-by: Josh Triplett <josh@freedesktop.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06 00:40:50 -07:00
Theodore Ts'o 27090aa1ea mergetool: Clean up description of files and prompts for merge resolutions
This fixes complaints from Junio for how messages and prompts are
printed when resolving symlink and deleted file merges.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-03-29 22:46:16 -04:00
Theodore Ts'o 1346c99963 mergetool: Make git-rm quiet when resolving a deleted file conflict
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-03-29 12:29:54 -04:00
Theodore Ts'o 365cf979c4 mergetool: Add support for Apple Mac OS X's opendiff command
Signed-off-by: Arjen Laarhoven <arjen@yaph.org>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-03-29 12:29:53 -04:00
Theodore Ts'o 5a174f1a2e mergetool: Fix abort command when resolving symlinks and deleted files
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-03-29 12:29:52 -04:00
Theodore Ts'o b7b36f92fd mergetool: Remove spurious error message if merge.tool config option not set
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-03-29 12:29:48 -04:00
Theodore Ts'o ddc0c49753 mergetool: factor out common code
Create common function check_unchanged(), save_backup() and
remove_backup().

Also fix some minor whitespace issues while we're at it.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-03-29 12:29:33 -04:00
Theodore Ts'o 262c981ea7 mergetool: portability fix: don't use reserved word function
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-03-29 12:23:01 -04:00
Theodore Ts'o d1dc6959bb mergetool: portability fix: don't assume true is in /bin
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-03-29 12:22:50 -04:00
Theodore Ts'o ce5b6d752b mergetool: Don't error out in the merge case where the local file is deleted
If the file we are trying to merge resolve is in git-ls-files -u, then
skip the file existence test.  If the file isn't reported in
git-ls-files, then check to see if the file exists or not to give an
appropriate error message.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-03-29 12:22:48 -04:00
Theodore Ts'o 20fa04ea6b mergetool: Replace use of "echo -n" with printf(1) to be more portable
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-03-29 12:22:44 -04:00
Theodore Ts'o d6678c28e3 mergetool: print an appropriate warning if merge.tool is unknown
Also add support for vimdiff

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-03-18 22:30:10 -04:00
James Bowes 9cec65399d mergetool: Add support for vimdiff.
Signed-off-by: James Bowes <jbowes@dangerouslyinc.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-03-18 22:13:48 -04:00
Theodore Ts'o c4b4a5af16 Add git-mergetool to run an appropriate merge conflict resolution program
The git-mergetool program can be used to automatically run an appropriate
merge resolution program to resolve merge conflicts.  It will automatically
run one of kdiff3, tkdiff, meld, xxdiff, or emacs emerge programs.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-03-13 20:14:05 -04:00