summaryrefslogtreecommitdiff
path: root/t/t7610-mergetool.sh
AgeCommit message (Collapse)AuthorFilesLines
2018-07-03t: use test_write_lines() instead of series of 'echo' commandsLibravatar Eric Sunshine1-4/+4
These tests employ a noisy subshell (with missing &&-chain) to feed input into Git commands or files: (echo a; echo b; echo c) | git some-command ... Simplify by taking advantage of test_write_lines(): test_write_lines a b c | git some-command ... Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-10-07tests: fix diff order arguments in test_cmpLibravatar Stefan Beller1-2/+2
Fix the argument order for test_cmp. When given the expected result first the diff shows the actual output with '+' and the expectation with '-', which is the convention for our tests. Signed-off-by: Stefan Beller <sbeller@google.com> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-01-18Merge branch 'rh/mergetool-regression-fix'Libravatar Junio C Hamano1-114/+165
"git mergetool" without any pathspec on the command line that is run from a subdirectory became no-op in Git v2.11 by mistake, which has been fixed. * rh/mergetool-regression-fix: mergetool: fix running in subdir when rerere enabled mergetool: take the "-O" out of $orderfile t7610: add test case for rerere+mergetool+subdir bug t7610: spell 'git reset --hard' consistently t7610: don't assume the checked-out commit t7610: always work on a test-specific branch t7610: delete some now-unnecessary 'git reset --hard' lines t7610: run 'git reset --hard' after each test to clean up t7610: don't rely on state from previous test t7610: use test_when_finished for cleanup tasks t7610: move setup code to the 'setup' test case t7610: update branch names to match test number rev-parse doc: pass "--" to rev-parse in the --prefix example .mailmap: record canonical email for Richard Hansen
2017-01-18Merge branch 'pb/test-must-fail-is-for-git'Libravatar Junio C Hamano1-1/+1
Test cleanup. * pb/test-must-fail-is-for-git: t9813: avoid using pipes don't use test_must_fail with grep
2017-01-10mergetool: fix running in subdir when rerere enabledLibravatar Richard Hansen1-1/+6
"git mergetool" (without any pathspec on the command line) that is not run from the top-level of the working tree no longer works in Git v2.11, failing to get the list of unmerged paths from the output of "git rerere remaining". This regression was introduced by 57937f70a0 ("mergetool: honor diff.orderFile", 2016-10-07). This is because the pathnames output by the 'git rerere remaining' command are relative to the top-level directory but the 'git diff --name-only' command expects its pathname arguments to be relative to the current working directory. To make everything consistent, cd_to_toplevel before running 'git diff --name-only' and adjust any relative pathnames. Signed-off-by: Richard Hansen <hansenr@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-01-10t7610: add test case for rerere+mergetool+subdir bugLibravatar Richard Hansen1-1/+20
If rerere is enabled and mergetool is run from a subdirectory, mergetool always prints "No files need merging". Add an expected failure test case for this situation. Signed-off-by: Richard Hansen <hansenr@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-01-10t7610: spell 'git reset --hard' consistentlyLibravatar Richard Hansen1-18/+19
Signed-off-by: Richard Hansen <hansenr@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-01-10t7610: don't assume the checked-out commitLibravatar Richard Hansen1-6/+6
Always check out the required commit at the beginning of the test so that a failure in a previous test does not cause the test to work off of the wrong commit. This is a step toward making the tests more independent so that if one test fails it doesn't cause subsequent tests to fail. Signed-off-by: Richard Hansen <hansenr@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-01-10t7610: always work on a test-specific branchLibravatar Richard Hansen1-2/+8
Create and use a test-specific branch when the test might create a commit. This is not always necessary for correctness, but it improves debuggability by ensuring a commit created by test #N shows up on the testN branch, not the branch for test #N-1. Signed-off-by: Richard Hansen <hansenr@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-01-10t7610: delete some now-unnecessary 'git reset --hard' linesLibravatar Richard Hansen1-2/+0
Tests now always run 'git reset --hard' at the end (even if they fail), so it's no longer necessary to run 'git reset --hard' at the beginning of a test. Signed-off-by: Richard Hansen <hansenr@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-01-10t7610: run 'git reset --hard' after each test to clean upLibravatar Richard Hansen1-0/+8
Use test_when_finished to run 'git reset --hard' after each test so that the repository is left in a saner state for the next test. This is a step toward making the tests more independent so that if one test fails it doesn't cause subsequent tests to fail. Signed-off-by: Richard Hansen <hansenr@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-01-10t7610: don't rely on state from previous testLibravatar Richard Hansen1-0/+6
If the repository must be in a particular state (beyond what is already done by the 'setup' test case) before the test can run, make the necessary repository changes in the test script even if it means duplicating some lines of code from the previous test case. This is a step toward making the tests more independent so that if one test fails it doesn't cause subsequent tests to fail. Signed-off-by: Richard Hansen <hansenr@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-01-10t7610: use test_when_finished for cleanup tasksLibravatar Richard Hansen1-34/+37
This is a step toward making the tests more independent so that if one test fails it doesn't cause subsequent tests to fail. Signed-off-by: Richard Hansen <hansenr@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-01-10t7610: move setup code to the 'setup' test caseLibravatar Richard Hansen1-30/+35
Multiple test cases depend on these hunks, so move them to the 'setup' test case. This is a step toward making the tests more independent so that if one test fails it doesn't cause subsequent tests to fail. Signed-off-by: Richard Hansen <hansenr@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-01-10t7610: update branch names to match test numberLibravatar Richard Hansen1-41/+41
Rename the testNN branches so that NN matches the test number. This should make it easier to troubleshoot test issues. Use $test_count to keep this future-proof. Signed-off-by: Richard Hansen <hansenr@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-01-07don't use test_must_fail with grepLibravatar Pranit Bauva1-1/+1
test_must_fail should only be used for testing git commands. To test the failure of other commands use `!`. Reported-by: Stefan Beller <sbeller@google.com> Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-12-16Merge branch 'ak/lazy-prereq-mktemp'Libravatar Junio C Hamano1-1/+2
Test code clean-up. * ak/lazy-prereq-mktemp: t7610: clean up foo.XXXXXX tmpdir
2016-11-29t7610: clean up foo.XXXXXX tmpdirLibravatar Jeff King1-1/+2
The lazy prereq for MKTEMP uses "mktemp -t" to see if mergetool's internal mktemp call will be able to run. But unlike the call inside mergetool, we do not ever bother to clean up the result, and the /tmp of git developers will slowly fill up with "foo.XXXXXX" directories as they run the test suite over and over. Let's clean up the directory after we've verified its creation. Note that we don't use test_when_finished here, and instead just make rmdir part of the &&-chain. We should only remove something that we're confident we just created. A failure in the middle of the chain either means there's nothing to clean up, or we are very confused and should err on the side of caution. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-10-11mergetool: honor -O<orderfile>Libravatar David Aguilar1-0/+27
Teach mergetool to pass "-O<orderfile>" down to `git diff` when specified on the command-line. Helped-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: David Aguilar <davvid@gmail.com> Reviewed-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-10-11mergetool: honor diff.orderFileLibravatar David Aguilar1-0/+33
Teach mergetool to get the list of files to edit via `diff` so that we gain support for diff.orderFile. Suggested-by: Luis Gutierrez <luisgutz@gmail.com> Helped-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: David Aguilar <davvid@gmail.com> Reviewed-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-07-06t7610: test for mktemp before test executionLibravatar Armin Kunaschik1-1/+6
mktemp is not available on all platforms, so the test 'temporary filenames are used with mergetool.writeToTemp' fails there. This patch does not replace mktemp but just disables the test that otherwise would fail. mergetool checks itself before executing mktemp and reports an error. Signed-off-by: Armin Kunaschik <megabreit@googlemail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-03-10mergetool: honor tempfile configuration when resolving delete conflictsLibravatar David Aguilar1-0/+25
Teach resolve_deleted_merge() to honor the mergetool.keepBackup and mergetool.keepTemporaries configuration knobs. This ensures that the worktree is kept pristine when resolving deletion conflicts with the variables both set to false. Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-03-10mergetool: support delete/delete conflictsLibravatar David Aguilar1-0/+39
If two branches each move a file into different directories then mergetool will fail because it assumes that the file being merged, and its parent directory, are present in the worktree. Create the merge file's parent directory to allow using the deleted base version of the file for merge resolution when encountering a delete/delete conflict. The end result is that a delete/delete conflict is presented for the user to resolve. Reported-by: Joe Einertson <joe@kidblog.org> Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-09-08t7610: don't use test_config in a subshellLibravatar John Keeping1-1/+1
test_config uses test_when_finished to reset the configuration after the test, but this does not work inside a subshell. This does not cause a problem here because the first thing the next test does is to set this config variable itself, but we are about to add a check that will complain when test_when_finished is used in a subshell. In this case, "subdir" not a submodule so test_config has the same effect when run at the top level and can simply be moved out of the subshell. Signed-off-by: John Keeping <john@keeping.me.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-10-21Merge branch 'da/mergetool-temporary-directory'Libravatar Junio C Hamano1-0/+23
Allow a temporary directory specified to be used while running "git mergetool" backend. * da/mergetool-temporary-directory: t7610-mergetool: add test cases for mergetool.writeToTemp mergetool: add an option for writing to a temporary directory
2014-10-16t7610-mergetool: add test cases for mergetool.writeToTempLibravatar David Aguilar1-0/+23
Add tests to ensure that filenames start with "./" when mergetool.writeToTemp is false and do not start with "./" when mergetool.writeToTemp is true. Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-10-16t7610-mergetool: use test_config to isolate testsLibravatar David Aguilar1-5/+3
Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-10-15t7610-mergetool: prefer test_config over git configLibravatar David Aguilar1-11/+9
Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-10-15t7610-mergetool: add missing && and remove commented-out codeLibravatar David Aguilar1-8/+2
Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-10-15t7610-mergetool: use tabs instead of a mix of tabs and spacesLibravatar David Aguilar1-459/+459
Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-06rm: delete .gitmodules entry of submodules removed from the work treeLibravatar Jens Lehmann1-3/+3
Currently using "git rm" on a submodule removes the submodule's work tree from that of the superproject and the gitlink from the index. But the submodule's section in .gitmodules is left untouched, which is a leftover of the now removed submodule and might irritate users (as opposed to the setting in .git/config, this must stay as a reminder that the user showed interest in this submodule so it will be repopulated later when an older commit is checked out). Let "git rm" help the user by not only removing the submodule from the work tree but by also removing the "submodule.<submodule name>" section from the .gitmodules file and stage both. This doesn't happen when the "--cached" option is used, as it would modify the work tree. This also silently does nothing when no .gitmodules file is found and only issues a warning when it doesn't have a section for this submodule. This is because the user might just use plain gitlinks without the .gitmodules file or has already removed the section by hand before issuing the "git rm" command (in which case the warning reminds him that rm would have done that for him). Only when .gitmodules is found and contains merge conflicts the rm command will fail and tell the user to resolve the conflict before trying again. Also extend the man page to inform the user about this new feature. While at it promote the submodule sub-section to a chapter as it made not much sense under "REMOVING FILES THAT HAVE DISAPPEARED FROM THE FILESYSTEM". In t7610 three uses of "git rm submod" had to be replaced with "git rm --cached submod" because that test expects .gitmodules and the work tree to stay untouched. Also in t7400 the tests for the remaining settings in the .gitmodules file had to be changed to assert that these settings are missing. Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-12Correct common spelling mistakes in comments and testsLibravatar Stefano Lattarini1-1/+1
Most of these were found using Lucas De Marchi's codespell tool. Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Acked-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-10-01Merge branch 'da/mergetool-custom'Libravatar Junio C Hamano1-0/+13
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-insLibravatar David Aguilar1-0/+13
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.: http://stackoverflow.com/questions/7435002/mergetool-from-gitconfig-being-ignored http://thread.gmane.org/gmane.comp.version-control.msysgit/13188 http://thread.gmane.org/gmane.comp.version-control.git/148267 Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-08-17stash: invoke rerere in case of conflictLibravatar Phil Hord1-1/+1
"stash apply" directly calls a backend merge function which does not automatically invoke rerere. This confuses mergetool when leftover rerere state is left behind from previous merges. Invoke rerere explicitly when we encounter a conflict during stash apply. This turns the test introduced by the previous commit to succeed. Signed-off-by: Phil Hord <hordp@cisco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-08-17test: git-stash conflict sets up rerereLibravatar Phil Hord1-0/+38
Add a test to make sure that a conflicted "stash apply" invokes rerere to record the conflicts and resolve the the files it can (the current code doesn't, so the test is marked as failing). Without correct state recorded for rerere, mergetool may be confused, causing it to think no files have conflicts even though they do. This condition is not verified by this test since a subsequent commit will change the behavior to enable rerere for stash conflicts. Also, the next test expected us to finish up with a reset, which is impossible to do if we fail (as we must) and it's an unreasonable expectation anyway. Begin the next test with a reset of its own instead. Signed-off-by: Phil Hord <hordp@cisco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-23mergetool: Provide an empty file when neededLibravatar David Aguilar1-1/+27
Some merge tools cannot cope when $LOCAL, $BASE, or $REMOTE are missing. $BASE can be missing when two branches independently add the same filename. Provide an empty file to make these tools happy. When a delete/modify conflict occurs, $LOCAL and $REMOTE can also be missing. We have special case code to handle such case so this change may not affect that codepath, but try to be consistent and create an empty file for them anyway. Reported-by: Jason Wenger <jcwenger@gmail.com> Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-26mergetool: Use args as pathspec to unmerged filesLibravatar Jonathon Mah1-18/+40
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>
2011-04-13mergetool: Teach about submodulesLibravatar Jonathon Mah1-3/+287
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>
2011-02-16mergetool: don't skip modify/remove conflictsLibravatar Martin von Zweigbergk1-6/+34
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>
2010-11-09tests: add missing &&Libravatar Jonathan Nieder1-1/+1
Breaks in a test assertion's && chain can potentially hide failures from earlier commands in the chain. Commands intended to fail should be marked with !, test_must_fail, or test_might_fail. The examples in this patch do not require that. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-24t7610: cd inside subshell instead of aroundLibravatar Brian Gernhardt1-23/+26
Instead of using `cd dir && (...) && cd..` use `(cd dir && ...)` This ensures that the test doesn't get caught in the subdirectory if there is an error in the subshell. Signed-off-by: Brian Gernhardt <brian@gernhardtsoftware.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-17mergetool: Skip autoresolved pathsLibravatar David Aguilar1-12/+34
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>
2009-01-31mergetool: fix running mergetool in sub-directoriesLibravatar Charles Bailey1-1/+1
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>
2009-01-31mergetool: Add a test for running mergetool in a sub-directoryLibravatar Charles Bailey1-19/+51
Signed-off-by: Charles Bailey <charles@hashpling.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-01-27mergetool: respect autocrlf by using checkout-indexLibravatar Charles Bailey1-2/+13
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>
2008-09-03tests: use "git xyzzy" form (t7200 - t9001)Libravatar Nanako Shiraishi1-1/+1
Converts tests between t7201-t9001. Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-13t/: Use "test_must_fail git" instead of "! git"Libravatar Stephan Beyer1-1/+1
This patch changes every occurrence of "! git" -- with the meaning that a git call has to gracefully fail -- into "test_must_fail git". This is useful to - make sure the test does not fail because of a signal, e.g. SIGSEGV, and - advertise the use of "test_must_fail" for new tests. Signed-off-by: Stephan Beyer <s-beyer@gmx.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-04Fix executable bits in t/ scriptsLibravatar Junio C Hamano1-0/+0
Pointed out by Ramsay Jones. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-05Add a very basic test script for git mergetoolLibravatar Charles Bailey1-0/+46
Signed-off-by: Charles Bailey <charles@hashpling.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>