summaryrefslogtreecommitdiff
path: root/git-mergetool.sh
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'jm/mergetool-pathspec'Junio C Hamano2011-10-101-49/+27
|\ | | | | | | | | | | * jm/mergetool-pathspec: mergetool: no longer need to save standard input mergetool: Use args as pathspec to unmerged files
| * mergetool: no longer need to save standard inputJunio C Hamano2011-09-261-6/+4
| | | | | | | | | | | | | | | | | | | | Earlier code wanted to run merge_file and prompt_after_failed_merge both of which wanted to read from the standard input of the entire script inside a while loop, which read from a pipe, and in order to do so, it redirected the original standard input to another file descriptor. We no longer need to do so after the previous change. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * mergetool: Use args as pathspec to unmerged filesJonathon Mah2011-09-261-48/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mergetool now treats its path arguments as a pathspec (like other git subcommands), restricting action to the given files and directories. Files matching the pathspec are filtered so mergetool only acts on unmerged paths; previously it would assume each path argument was in an unresolved state, and get confused when it couldn't check out their other stages. Running "git mergetool subdir" will prompt to resolve all conflicted blobs under subdir. Signed-off-by: Jonathon Mah <me@JonathonMah.com> Acked-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | git-mergetool: check return value from readJay Soffian2011-09-191-1/+1
| | | | | | | | | | | | | | | | Mostly fixed already by 6b44577 (mergetool: check return value from read, 2011-07-01). Catch two uses it missed. Signed-off-by: Jay Soffian <jaysoffian@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | mergetool: check return value from readJunio C Hamano2011-07-011-4/+4
|/ | | | | | | The process may not even have the standard input open in which case it will get stuck in an infinite loop to prompt and read nothing. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* mergetool: Teach about submodulesJonathon Mah2011-04-131-6/+84
| | | | | | | | | | | | | | | | | | | | | When the index has conflicted submodules, mergetool used to mildly clobber the module, renaming it to mymodule.BACKUP.nnnn, then failing to copy it non-recursively. Recognize submodules and offer a resolution instead: Submodule merge conflict for 'Shared': {local}: submodule commit ad9f12e3e6205381bf2163a793d1e596a9e211d0 {remote}: submodule commit f5893fb70ec5646efcd9aa643c5136753ac89253 Use (l)ocal or (r)emote, or (a)bort? Selecting a commit will stage it, but not update the submodule (as git does had there been no conflict). Type changes are also supported, should the path be a submodule on one side, and a file, symlink, directory, or deleted on the other. Signed-off-by: Jonathon Mah <me@JonathonMah.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* mergetool: don't skip modify/remove conflictsMartin von Zweigbergk2011-02-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Since bb0a484 (mergetool: Skip autoresolved paths, 2010-08-17), mergetool uses different ways of figuring out the list of files with merge conflicts depending on whether rerere is active. If rerere is active, mergetool will use 'git rerere status' to list the files with remaining conflicts. However, the output from that command does not list conflicts of types that rerere does not handle, such as modify/remove conflicts. Another problem with solely relying on the output from 'git rerere status' is that, for new conflicts that are not yet known to rerere, the output from the command will list the files even after adding them to the index. This means that if the conflicts in some files have been resolved and 'git mergetool' is run again, it will ask the user something like the following for each of those files. file1: file does not need merging Continue merging other unresolved paths (y/n) ? Solve both of these problems by replacing the call to 'git rerere status' with a call to the new 'git rerere remaining' that was introduced in the previous commit. Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'cb/maint-mergetool-no-tty'Junio C Hamano2010-09-031-2/+6
|\ | | | | | | | | | | | | | | * cb/maint-mergetool-no-tty: mergetool: Remove explicit references to /dev/tty Conflicts: git-mergetool.sh
| * mergetool: Remove explicit references to /dev/ttyCharles Bailey2010-08-201-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mergetool used /dev/tty to switch back to receiving input from the user via inside a block with a redirected stdin. This harms testability, so change mergetool to save its original stdin to an alternative fd in this block and restore it for those sub-commands that need the original stdin. Includes additional compatibility fix from Jonathan Nieder. Tested-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Charles Bailey <charles@hashpling.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | mergetool: Skip autoresolved pathsDavid Aguilar2010-08-171-5/+23
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When mergetool is run without path limiters it loops over each entry in 'git ls-files -u'. This includes autoresolved paths. Teach mergetool to only merge files listed in 'rerere status' when rerere is enabled. There are some subtle but harmless changes in behavior. We now call cd_to_toplevel when no paths are given. We do this because 'rerere status' paths are always relative to the root. This is beneficial for the non-rerere use as well in that mergetool now runs against all unmerged files regardless of the current directory. This also slightly tweaks the output when run without paths to be more readable. The old output: Merging the files: foo bar baz The new output: Merging: foo bar baz Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* mergetool--lib: simplify API usage by removing more global variablesDavid Aguilar2009-04-121-7/+8
| | | | | | | | | | | | | The mergetool--lib scriplet was tricky to use because it relied upon the existance of several global shell variables. This removes more global variables so that things are simpler for callers. A side effect is that some variables are recomputed each time run_merge_tool() is called, but the overhead for recomputing them is justified by the simpler implementation. Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Fix misspelled mergetool.keepBackupFerry Huberts2009-04-111-1/+1
| | | | | | | In several places mergetool.keepBackup was misspelled as merge.keepBackup. Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* difftool/mergetool: refactor commands to use git-mergetool--libDavid Aguilar2009-04-081-211/+13
| | | | | | | | This consolidates the common functionality from git-mergetool and git-difftool--helper into a single git-mergetool--lib scriptlet. Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* mergetool: use $( ... ) instead of `backticks`David Aguilar2009-04-071-8/+8
| | | | | | | This makes mergetool consistent with Documentation/CodingGuidelines. Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* difftool/mergetool: add diffuse as merge and diff toolSebastian Pipping2009-04-071-2/+2
| | | | | | | | This adds diffuse as a built-in merge tool. Signed-off-by: Sebastian Pipping <sebastian@pipping.org> Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git-mergetool: add new merge tool TortoiseMergeMarkus Heidelberg2009-04-071-3/+13
| | | | | | | | | | | | | | TortoiseMerge comes with TortoiseSVN or TortoiseGit for Windows. It can only be used as a merge tool with an existing base file. It cannot be used without a base nor as a diff tool. The documentation only mentions the slash '/' as command line option prefix, which refused to work, but the parser also accepts the dash '-' See http://code.google.com/p/msysgit/issues/detail?id=226 Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git-mergetool/difftool: make (g)vimdiff workable under WindowsMarkus Heidelberg2009-04-071-2/+8
| | | | | | | | | | | | | | | | | Under Windows vimdiff and gvimdiff are not available as symbolic links, but as batch files vimdiff.bat and gvimdiff.bat. These files weren't found by 'type vimdiff' which led to the following error: The merge tool vimdiff is not available as 'vimdiff' Even if they were found, it wouldn't work to invoke these batch files from git-mergetool. To solve this, use vim and gvim (vim.exe and gvim.exe) and pass the -d command line switch over to them. Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'cb/mergetool'Junio C Hamano2009-02-051-4/+11
|\ | | | | | | | | | | | | * cb/mergetool: mergetool: fix running mergetool in sub-directories mergetool: Add a test for running mergetool in a sub-directory mergetool: respect autocrlf by using checkout-index
| * mergetool: fix running mergetool in sub-directoriesCharles Bailey2009-01-311-5/+4
| | | | | | | | | | | | | | | | | | | | | | The previous fix to mergetool to use checkout-index instead of cat-file broke running mergetool anywhere except the root of the repository. This fixes it by using the correct relative paths for temporary files and index paths. Signed-off-by: Charles Bailey <charles@hashpling.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * mergetool: respect autocrlf by using checkout-indexCharles Bailey2009-01-271-3/+11
| | | | | | | | | | | | | | | | | | | | Previously, git mergetool used cat-file which does not perform git to worktree conversion. This changes mergetool to use git checkout-index instead which means that the temporary files used for mergetool use the correct line endings for the platform. Signed-off-by: Charles Bailey <charles@hashpling.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | mergetool: Don't repeat merge tool candidatesJohannes Gilger2009-01-271-10/+8
|/ | | | | | | | | | | | | git mergetool listed some candidates for mergetools twice, depending on the environment. This slightly changes the behavior when both KDE_FULL_SESSION and GNOME_DESKTOP_SESSION_ID are set at the same time; in such a case meld is used in favor of kdiff3 (the old code favored kdiff3 in such a case), but it should not matter in practice. Signed-off-by: Johannes Gilger <heipei@hackvalue.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* mergetool: put the cursor on the editable file for VimMarkus Heidelberg2009-01-181-2/+7
| | | | | | | | | | When resolving conflicts, you only need to edit the $MERGED file. Put the cursor automatically into its window for vimdiff and gvimdiff to avoid doing <C-w>l every time. Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de> Tested-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'cb/mergetool'Junio C Hamano2009-01-011-30/+80
|\ | | | | | | | | | | | | | | * cb/mergetool: mergetool: Don't keep temporary merge files unless told to mergetool: Add prompt to continue after failing to merge a file Add -y/--no-prompt option to mergetool Fix some tab/space inconsistencies in git-mergetool.sh
| * mergetool: Don't keep temporary merge files unless told toCharles Bailey2008-12-121-0/+6
| | | | | | | | | | | | | | | | | | | | | | This changes git mergetool to remove the temporary files used to invoke the merge tool even if it returns non-zero. This also adds a configuration option (mergetool.keepTemporaries) to retain the previous behaviour if desired. Signed-off-by: Charles Bailey <charles@hashpling.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * mergetool: Add prompt to continue after failing to merge a fileCharles Bailey2008-12-121-9/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This option stops git mergetool from aborting at the first failed merge. After a failed merge the user will be prompted to indicated whether he wishes to continue with attempting to merge subsequent paths or to abort. This allows some additional use patterns. Merge conflicts can now be previewed one at time and merges can also be skipped so that they can be performed in a later pass. Signed-off-by: Charles Bailey <charles@hashpling.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * Add -y/--no-prompt option to mergetoolCharles Bailey2008-11-141-3/+13
| | | | | | | | | | | | | | | | | | | | | | This option lets git mergetool invoke the conflict resolution program without waiting for a user prompt each time. Also added a mergetool.prompt (default true) configuration variable controlling the same behaviour Signed-off-by: Charles Bailey <charles@hashpling.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * Fix some tab/space inconsistencies in git-mergetool.shCharles Bailey2008-11-141-19/+19
| | | | | | | | | | | | | | | | | | git-mergetool.sh mostly uses 8 space tabs and 4 spaces per indent. This change corrects this in a part of the file affect by a later commit in this patch series. diff -w considers this change is to be a null change. Signed-off-by: Charles Bailey <charles@hashpling.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | git-mergetool: properly handle "git mergetool -- filename"David Aguilar2008-12-191-0/+1
|/ | | | | | | | | 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>
* Remove the use of '--' in merge program invocationPatrick Higgins2008-06-191-12/+12
| | | | | | | | | | | | 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>
* mergetool: Make ECMerge use the settings as specified by the user in the GUISebastian Schuberth2008-05-111-2/+2
| | | | | | | | | | | | | | 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>
* Teach git mergetool to use custom commands defined at config timeCharles Bailey2008-03-051-2/+26
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* Changed an internal variable of mergetool to support custom commandsCharles Bailey2008-03-051-50/+50
| | | | | | | | 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>
* Tidy up git mergetool's backup file behaviourCharles Bailey2008-03-051-24/+13
| | | | | | | | | | | | 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>
* Allow git-mergetool to handle paths with a leading spaceRogan Dawes2008-01-071-2/+5
| | | | Signed-off-by: Rogan Dawes <rogan@dawes.za.net>
* Open external merge tool with original file extensions for all three filesPini Reznik2007-12-051-4/+5
| | | | | | | | | | | | 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>
* scripts: Add placeholders for OPTIONS_SPECJunio C Hamano2007-11-061-0/+1
| | | | | | | | | --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>
* mergetool: avoid misleading message "Resetting to default..."Steffen Prohaska2007-10-181-1/+1
| | | | | | | | | | | 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>
* mergetool: add support for ECMergeSteffen Prohaska2007-10-181-1/+11
| | | | | | | | 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>
* mergetool: use path to mergetool in config var mergetool.<tool>.pathSteffen Prohaska2007-10-181-43/+54
| | | | | | | | | | | | | | | | | 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>
* mergetool: Fix typo in options passed to kdiff3Theodore Ts'o2007-09-281-2/+2
| | | | | | Fix missing double hyphens in "-L1" and "-L2" Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* mergetool: fix emerge when running in a subdirectoryTheodore Ts'o2007-09-281-2/+2
| | | | | | | | | | 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>
* Mergetool generating blank files (1.5.3)Junio C Hamano2007-09-281-3/+4
| | | | | | | | | | 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>
* Supplant the "while case ... break ;; esac" idiomDavid Kastrup2007-09-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | 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>
* Rewrite "git-frotz" to "git frotz"Junio C Hamano2007-07-021-8/+8
| | | | | | This uses the remove-dashes target to replace "git-frotz" to "git frotz". Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git-mergetool: Make default selection of merge-tool more intelligentTheodore Ts'o2007-06-101-17/+29
| | | | | | | | | 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>
* [PATCH] git-mergetool: Allow gvimdiff to be used as a mergetoolDan McGee2007-06-101-2/+10
| | | | | Signed-off-by: Dan McGee <dpmcgee@gmail.com> Acked-by: "Theodore Ts'o" <tytso@mit.edu>
* Fix typo in git-mergetoolJosh Triplett2007-06-061-1/+1
| | | | | Signed-off-by: Josh Triplett <josh@freedesktop.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* mergetool: Clean up description of files and prompts for merge resolutionsTheodore Ts'o2007-03-291-12/+15
| | | | | | | 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>
* mergetool: Make git-rm quiet when resolving a deleted file conflictTheodore Ts'o2007-03-291-1/+1
| | | | Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* mergetool: Add support for Apple Mac OS X's opendiff commandTheodore Ts'o2007-03-291-2/+14
| | | | | Signed-off-by: Arjen Laarhoven <arjen@yaph.org> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>