path: root/mergetools
AgeCommit message (Collapse)Author
2019-04-04mergetools: add support for smerge (Sublime Merge)David Aguilar
Teach difftool and mergetool about the Sublime Merge "smerge" command. Signed-off-by: David Aguilar <> Signed-off-by: Junio C Hamano <>
2018-04-05mergetools: add support for guiffyBill Ritcher
Add guiffy as difftool and mergetool guiffy is available on Windows, Linux, and MacOS Signed-off-by: Bill Ritcher <> Reviewed-by: David Aguilar <> Signed-off-by: Junio C Hamano <>
2017-06-19mergetools/meld: improve compatibiilty with Meld on macOS XDavid Aguilar
The macOS X fork of Meld[1] requires a "=" in the "--output" argument, as it uses a wrapper[2] script that munges the "--output" argument before calling into the common "meld" script. The macOS X wrapper script[2] accepts "--output=<filename>" only, despite the fact that the underlying meld code accepts both "--output <filename" and "--output=<filename>"[3]. All versions of meld which accept "--output" accept it in the "--output=<filename>" form, so use "--output=<file>" for maximum compatibility. [1] [2] [3] Reported-by: Matthew Groth <> Helped-by: Samuel Lijin <> Signed-off-by: David Aguilar <> Signed-off-by: Junio C Hamano <>
2016-12-19Merge branch 'da/mergetool-xxdiff-hotkey'Junio C Hamano
The way to specify hotkeys to "xxdiff" that is used by "git mergetool" has been modernized to match recent versions of xxdiff. * da/mergetool-xxdiff-hotkey: mergetools: fix xxdiff hotkeys
2016-12-12mergetools: fix xxdiff hotkeysDavid Aguilar
xxdiff was using a mix of "Ctrl-<key>" and "Ctrl+<key>" hotkeys. The dashed "-" form is not accepted by newer xxdiff versions. Use the plus "+" form only. Signed-off-by: David Aguilar <> Signed-off-by: Junio C Hamano <>
2016-11-29mergetools/vimdiff: trust Vim's exit codeDavid Aguilar
Allow vimdiff users to signal that they do not want to use the result of a merge by exiting with ":cquit", which tells Vim to exit with an error code. This is better than the current behavior because it allows users to directly flag that the merge is bad, using a standard Vim feature, rather than relying on a timestamp heuristic that is unforgiving to users that save in-progress merge files. The original behavior can be restored by configuring mergetool.vimdiff.trustExitCode to false. Reported-by: Dun Peal <> Signed-off-by: David Aguilar <> Signed-off-by: Junio C Hamano <>
2016-11-29mergetool: honor mergetool.$tool.trustExitCode for built-in toolsDavid Aguilar
Built-in merge tools contain a hard-coded assumption about whether or not a tool's exit code can be trusted to determine the success or failure of a merge. Tools whose exit codes are not trusted contain calls to check_unchanged() in their merge_cmd() functions. A problem with this is that the trustExitCode configuration is not honored for built-in tools. Teach built-in tools to honor the trustExitCode configuration. Extend run_merge_cmd() so that it is responsible for calling check_unchanged() when a tool's exit code cannot be trusted. Remove check_unchanged() calls from scriptlets since they are no longer responsible for calling it. When no configuration is present, exit_code_trustable() is checked to see whether the exit code should be trusted. The default implementation returns false. Tools whose exit codes can be trusted override exit_code_trustable() to true. Reported-by: Dun Peal <> Signed-off-by: David Aguilar <> Signed-off-by: Junio C Hamano <>
2016-04-04mergetools: add support for ExamDiffJacob Nisnevich
Signed-off-by: Jacob Nisnevich <> Acked-by: David Aguilar <> Signed-off-by: Junio C Hamano <>
2016-04-04mergetools: create mergetool_find_win32_cmd() helper function for winmergeJacob Nisnevich
Signed-off-by: Jacob Nisnevich <> Acked-by: David Aguilar <> Signed-off-by: Junio C Hamano <>
2016-02-12mergetool: reorder vim/gvim buffers in three-way diffsDickson Wong
When invoking default (g)vimdiff three-way merge, the merged file is loaded as the first buffer but moved to the bottom as the fourth window. This causes a disconnect between vim commands that operate on window positions (e.g. CTRL-W_w) and those that operate on buffer index (e.g. do/dp). This change reorders the buffers to have the same index as windows while keeping the cursor default to the merged result as the bottom window. Signed-off-by: Dickson Wong <> Tested-by: Michael J Gruber <> Acked-by: David Aguilar <> Signed-off-by: Junio C Hamano <>
2015-05-20mergetools: add winmerge as a builtin toolDavid Aguilar
Add a winmerge scriptlet with the commands described in [1] so that users can use winmerge without needing to perform any additional configuration. [1] Helped-by: Philip Oakley <> Helped-by: Johannes Schindelin <> Helped-by: Sebastian Schuberth <> Helped-by: SZEDER Gábor <> Signed-off-by: David Aguilar <> Signed-off-by: Junio C Hamano <>
2014-11-21mergetools: stop setting $status in merge_cmd()David Aguilar
No callers rely on $status so there's don't need to set it during merge_cmd() for diffmerge, emerge, and kdiff3. Signed-off-by: David Aguilar <> Signed-off-by: Junio C Hamano <>
2014-10-29Merge branch 'oc/mergetools-beyondcompare'Junio C Hamano
* oc/mergetools-beyondcompare: mergetool: rename bc3 to bc
2014-10-21mergetool: rename bc3 to bcJunio C Hamano
Beyond Compare version 4 works the same way as version 3, so rename the existing "bc3" adaptor to just "bc", while keeping "bc3" as a backward compatible wrapper. Noticed-by: Olivier Croquette <> Helped-by: David Aguilar <> Signed-off-by: Junio C Hamano <>
2014-10-16mergetools/meld: make usage of `--output` configurable and more robustDavid Aguilar
Older versions of meld listed --output in `meld --help`. Newer versions only mention `meld [OPTIONS...]`. Improve the checks to catch these newer versions. Add a `mergetool.meld.hasOutput` configuration to allow overriding the heuristic. Reported-by: Andrey Novoseltsev <> Helped-by: Junio C Hamano <> Signed-off-by: David Aguilar <> Signed-off-by: Junio C Hamano <>
2014-04-22mergetools: add vimdiff3 modeFelipe Contreras
It's similar to the default, except that the other windows are hidden. This ensures that removed/added colors are still visible on the main merge window, but the other windows not visible. Specially useful with merge.conflictstyle=diff3. Signed-off-by: Felipe Contreras <> Acked-by: David Aguilar <> Signed-off-by: Junio C Hamano <>
2013-10-13mergetools/diffmerge: support DiffMerge as a git mergetoolStefan Saasen
DiffMerge is a non-free (but gratis) tool that supports OS X, Windows and Linux. See DiffMerge includes a script `/usr/bin/diffmerge` that can be used to launch the graphical compare tool. This change adds mergetool support for DiffMerge and adds 'diffmerge' as an option to the mergetool help. Signed-off-by: Stefan Saasen <> Acked-by: David Aguilar <> Signed-off-by: Jonathan Nieder <>
2013-05-09Sync with v1.8.2.3Junio C Hamano
* maint: Git t5004: avoid using tar for checking emptiness of archive t5004: ignore pax global header file mergetools/kdiff3: do not use --auto when diffing transport-helper: trivial style cleanup
2013-05-09mergetools/kdiff3: do not use --auto when diffingDavid Aguilar
The `kdiff3 --auto` help message is, "No GUI if all conflicts are auto- solvable." This flag was carried over from the original mergetool commands. diff_cmd() is for two-way comparisons only so remove the superfluous flag. Signed-off-by: David Aguilar <> Signed-off-by: Junio C Hamano <>
2013-03-13mergetools/p4merge: create a base if none availableKevin Bracey
Originally, with no base, Git gave P4Merge $LOCAL as a dummy base: p4merge "$LOCAL" "$LOCAL" "$REMOTE" "$MERGED" Commit 0a0ec7bd changed this to: p4merge "empty file" "$LOCAL" "$REMOTE" "$MERGED" to avoid the problem of being unable to save in some circumstances with similar inputs. Unfortunately this approach produces much worse results on differing inputs. P4Merge really regards the blank file as the base, and once you have just a couple of differences between the two branches you end up with one a massive full-file conflict. The 3-way diff is not readable, and you have to invoke "difftool MERGE_HEAD HEAD" manually to get a useful view. The original approach appears to have invoked special 2-way merge behaviour in P4Merge that occurs only if the base filename is "" or equal to the left input. You get a good visual comparison, and it does not auto-resolve differences. (Normally if one branch matched the base, it would autoresolve to the other branch). But there appears to be no way of getting this 2-way behaviour and being able to reliably save. Having base==left appears to be triggering other assumptions. There are tricks the user can use to force the save icon on, but it's not intuitive. So we now follow a suggestion given in the original patch's discussion: generate a virtual base, consisting of the lines common to the two branches. This is the same as the technique used in resolve and octopus merges, so we relocate that code to a shared function. Note that if there are no differences at the same location, this technique can lead to automatic resolution without conflict, combining everything from the 2 files. As with the other merges using this technique, we assume the user will inspect the result before saving. Signed-off-by: Kevin Bracey <> Reviewed-by: David Aguilar <> Signed-off-by: Junio C Hamano <>
2013-03-13mergetools/p4merge: swap LOCAL and REMOTEKevin Bracey
Reverse LOCAL and REMOTE when invoking P4Merge as a mergetool, so that the incoming branch is now in the left-hand, blue triangle pane, and the current branch is in the right-hand, green circle pane. This change makes use of P4Merge consistent with its built-in help, its reference documentation, and Perforce itself. But most importantly, it makes merge results clearer. P4Merge is not totally symmetrical between left and right; despite changing a few text labels from "theirs/ours" to "left/right" when invoked manually, it still retains its original Perforce "theirs/ours" viewpoint. Most obviously, in the result pane P4Merge shows changes that are common to both branches in green. This is on the basis of the current branch being green, as it is when invoked from Perforce; it means that lines in the result are blue if and only if they are being changed by the merge, making the resulting diff clearer. Note that P4Merge now shows "ours" on the right for both diff and merge, unlike other diff/mergetools, which always have REMOTE on the right. But observe that REMOTE is the working tree (ie "ours") for a diff, while it's another branch (ie "theirs") for a merge. Ours and theirs are reversed for a rebase - see "git help rebase". However, this does produce the desired "show the results of this commit" effect in P4Merge - changes that remain in the rebased commit (in your branch, but not in the new base) appear in blue; changes that do not appear in the rebased commit (from the new base, or common to both) are in green. If Perforce had rebase, they'd probably not swap ours/theirs, but make P4Merge show common changes in blue, picking out our changes in green. We can't do that, so this is next best. Signed-off-by: Kevin Bracey <> Reviewed-by: David Aguilar <> Signed-off-by: Junio C Hamano <>
2013-02-15Merge branch 'da/p4merge-mktemp-fix'Junio C Hamano
* da/p4merge-mktemp-fix: p4merge: fix printf usage
2013-02-10p4merge: fix printf usageDavid Aguilar
Do not use a random string as if it is a format string for printf when showing it literally; instead feed it to '%s' format. Reported-by: Asheesh Laroia <> Signed-off-by: David Aguilar <> Signed-off-by: Junio C Hamano <>
2013-02-07Merge branch 'ss/mergetools-tortoise'Junio C Hamano
Update mergetools to work better with newer merge helper tortoise ships. * ss/mergetools-tortoise: mergetools: teach tortoisemerge to handle filenames with SP correctly mergetools: support TortoiseGitMerge
2013-02-07Merge branch 'jk/mergetool'Junio C Hamano
Cleans up mergetool/difftool combo. * jk/mergetool: mergetools: simplify how we handle "vim" and "defaults" mergetool--lib: don't call "exit" in setup_tool mergetool--lib: improve show_tool_help() output mergetools/vim: remove redundant diff command git-difftool: use git-mergetool--lib for "--tool-help" git-mergetool: don't hardcode 'mergetool' in show_tool_help git-mergetool: remove redundant assignment git-mergetool: move show_tool_help to mergetool--lib
2013-02-02mergetools: teach tortoisemerge to handle filenames with SP correctlySven Strickroth
TortoiseGitMerge, unlike TortoiseMerge, can be told to handle paths with spaces in them by using -option "$FILE" (not -option:"$FILE", which does not work for such paths) syntax. This change was necessary because of MSYS path mangling [1], the ":" after the "base" etc. arguments to TortoiseMerge caused the whole argument instead of just the file name to be quoted in case of file names with spaces. So TortoiseMerge was passed "-base:new file.txt" instead of -base:"new file.txt" (including the quotes). To work around this, TortoiseGitMerge does not require the ":" after the arguments anymore which fixes handling file names with spaces [2] (as written above). [1] [2] Signed-off-by: Sven Strickroth <> Reported-by: Sebastian Schuberth <> Signed-off-by: Junio C Hamano <>
2013-01-29mergetools: simplify how we handle "vim" and "defaults"David Aguilar
Remove the exceptions for "vim" and "defaults" in the mergetool library so that every filename in mergetools/ matches 1:1 with the name of a valid built-in tool. Define the trivial fallback definition of shell functions in-line in git-mergetool-lib script, instead of dot-sourcing them from another file. The result is much easier to follow. [jc: squashed in an update from John Keeping as well] Signed-off-by: David Aguilar <> Signed-off-by: Junio C Hamano <>
2013-01-28mergetools/vim: remove redundant diff commandDavid Aguilar
vimdiff and vimdiff2 differ only by their merge command so remove the logic in the diff command since it's not actually needed. Signed-off-by: David Aguilar <> Signed-off-by: Junio C Hamano <>
2013-01-27mergetools: support TortoiseGitMergeSven Strickroth
TortoiseMerge.exe was ben renamed to TortoiseGitMerge.exe (starting with 1.8.0) in order to make it clear that it has special support for git, and prevent confusion with the TortoiseSVN TortoiseMerge version. Signed-off-by: Sven Strickroth <> Signed-off-by: Junio C Hamano <>
2012-12-27mergetools/p4merge: Honor $TMPDIR for the /dev/null placeholderDavid Aguilar
Use $TMPDIR when creating the /dev/null placeholder for p4merge. This prevents users from finding a seemingly random untracked file in their worktree. This is different than what mergetool does with $LOCAL and $REMOTE because those files exist to aid users when resolving merges. p4merge's /dev/null placeholder is not helpful in that situation so it is sensible to keep it out of the worktree. Reported-by: Jeremy Morton <> Signed-off-by: David Aguilar <> Signed-off-by: Junio C Hamano <>
2012-10-25Merge branch 'da/mergetools-p4'Jeff King
* da/mergetools-p4: mergetools/p4merge: Handle "/dev/null"
2012-10-11mergetools/p4merge: Handle "/dev/null"David Aguilar
p4merge does not properly handle the case where "/dev/null" is passed as a filename. Work it around by creating a temporary file for this purpose. Reported-by: Jeremy Morton <> Signed-off-by: David Aguilar <> Signed-off-by: Junio C Hamano <> --- Needs to be amended with Tested-by when a report comes...
2012-10-01Merge branch 'da/mergetool-custom'Junio C Hamano
The actual external command to run for mergetool backend can be specified with difftool/mergetool.$name.cmd configuration variables, but this mechanism was ignored for the backends we natively support. * da/mergetool-custom: mergetool--lib: Allow custom commands to override built-ins
2012-09-25mergetool--lib: Allow custom commands to override built-insDavid Aguilar
Allow users to override the default commands provided by the mergetools/* scriptlets. Users occasionally run into problems where they expect to be able to override the built-in tool names. The documentation does not explicitly mention that built-ins cannot be overridden, so it's easy to assume that it should work. Lift this restriction so that built-in tools are handled the same way as user-configured tools. Add tests to guarantee this behavior. A nice benefit of this change is that it protects users from having future versions of git trump their custom configuration with a new built-in tool. C.f.: Signed-off-by: David Aguilar <> Signed-off-by: Junio C Hamano <>
2012-08-10Add Code Compare v2.80.4 as a merge / diff tool for WindowsSebastian Schuberth
Code Compare is a commercial file comparison tool for Windows, see Version 2.80.4 added support for command line arguments preceded by a dash instead of a slash. This is required for Git for Windows because slashes in command line arguments get mangled with according to these rules: Signed-off-by: Sebastian Schuberth <> Signed-off-by: Junio C Hamano <>
2012-03-05mergetools: add a plug-in to support DeltaWalkerTim Henigan
DeltaWalker is a non-free tool popular among some users. Add a plug-in to support it from difftool and mergetool. Note that the $(pwd)/ in front of $MERGED should not be necessary. However without it, DeltaWalker crashes with a JRE exception. Signed-off-by: Tim Henigan <> Helped-by: David Aguilar <> Signed-off-by: Junio C Hamano <>
2012-02-14Merge branch 'jn/ancient-meld-support'Junio C Hamano
* jn/ancient-meld-support: mergetools/meld: Use --help output to detect --output support
2012-02-10mergetools/meld: Use --help output to detect --output supportJonathan Nieder
In v1.7.7-rc0~3^2 (2011-08-19), git mergetool's "meld" support learned to use the --output option when calling versions of meld that are detected to support it (1.5.0 and newer, hopefully). Alas, it misdetects old versions (before 1.1.5, 2006-06-11) of meld as supporting the option, so on systems with such meld, instead of getting a nice merge helper, the operator gets a dialog box with the text "Wrong number of arguments (Got 5)". (Version 1.1.5 is when meld switched to using optparse. One consequence of that change was that errors in usage are detected and signalled through the exit status even when --help was passed.) Luckily there is a simpler check that is more reliable: the usage string printed by "meld --help" reliably reflects whether --output is supported in a given version. Use it. Reported-by: Jeff Epler <> Signed-off-by: Jonathan Nieder <> Signed-off-by: Junio C Hamano <>
2011-10-16mergetools: use the correct tool for Beyond Compare 3 on WindowsPat Thoyts
On Windows the bcompare tool launches a graphical program and does not wait for it to terminate. A separate 'bcomp' tool is provided which will wait for the view to exit so we use this instead. Reported-by: Werner BEROUX <> Signed-off-by: Pat Thoyts <> Signed-off-by: Junio C Hamano <>
2011-08-19mergetools/meld: Use '--output' when availableDavid Aguilar
meld 1.5.0 and newer allow the output file to be specified when merging multiple files. Check whether the meld command supports '--output' and use it when available. Signed-off-by: David Aguilar <> Signed-off-by: Junio C Hamano <>
2011-08-19mergetool--lib: Refactor tools into separate filesDavid Aguilar
Individual merge tools are now defined in a mergetools/$tool file which is sourced at runtime. The individual files are installed into $(git --exec-path)/mergetools/. New tools can be added by creating a new file instead of editing the scriptlet. Signed-off-by: David Aguilar <> Signed-off-by: Junio C Hamano <>