Like many git commands, git-mergetool allows "--" to signal
the end of option processing. This adds a missing "shift"
statement so that this is correctly handled.
Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Put a "./" at the beginning of all paths given to the merge program so
that filenames beginning with a '-' character don't get interpreted as
options.
This deals with a problem where kdiff3 can be compiled with or without
support for the '--' separator between options and filenames.
Signed-off-by: Patrick Higgins <patrick.higgins@cexp.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
When run from the command line, ECMerge does not automatically use the same
settings for a merge / diff that it would use when starting the GUI and loading
files manually. In the first case the built-in factory defaults would be used,
while in the second case the settings the user has specified in the GUI would
be used, which can be misleading. Specifying the "--default" command line
option changes this behavior so that always the user specfified GUI settings
are used.
Signed-off-by: Sebastian Schuberth <sschuberth@visageimaging.com>
Tested-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
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>
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>
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>
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>
--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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>