{"thread":{"id":"44811","subject":"[PATCH 2/4] t7610: make tests more independent and debuggable","startedAt":"2017-01-04T00:58:29Z","lastAt":"2017-01-10T20:43:38Z","messageCount":76,"participants":["Richard Hansen","Stefan Beller","Simon Ruderich","Johannes Sixt","Junio C Hamano","David Aguilar"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"308747","messageId":"20170104005042.51530-3-hansenr@google.com","threadId":"44811","inReplyTo":"20170104005042.51530-1-hansenr@google.com","subject":"[PATCH 2/4] t7610: make tests more independent and debuggable","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-04T00:50:40Z","receivedAt":"2017-01-04T00:58:29Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"If a test fails it might leave the repository in a strange state.  Add\n'git reset --hard' at the beginning of each test to increase the odds\nof passing when an earlier test fails.\n\nAlso use test-specific branches to avoid interfering with later tests\nand to make the tests easier to debug.\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n t/t7610-mergetool.sh | 27 +++++++++++++++++++++++++++\n 1 file changed, 27 insertions(+)\n\ndiff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh\nindex 14090739f..8e2b4e147 100755\n--- a/t/t7610-mergetool.sh\n+++ b/t/t7610-mergetool.sh\n@@ -94,6 +94,7 @@ test_expect_success 'setup' '\n '\n \n test_expect_success 'custom mergetool' '\n+\tgit reset --hard &&\n \tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \ttest_must_fail git merge master >/dev/null 2>&1 &&\n@@ -112,6 +113,7 @@ test_expect_success 'custom mergetool' '\n '\n \n test_expect_success 'mergetool crlf' '\n+\tgit reset --hard &&\n \ttest_config core.autocrlf true &&\n \tgit checkout -b test$test_count branch1 &&\n \ttest_must_fail git merge master >/dev/null 2>&1 &&\n@@ -134,6 +136,7 @@ test_expect_success 'mergetool crlf' '\n '\n \n test_expect_success 'mergetool in subdir' '\n+\tgit reset --hard &&\n \tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \t(\n@@ -145,8 +148,13 @@ test_expect_success 'mergetool in subdir' '\n '\n \n test_expect_success 'mergetool on file in parent dir' '\n+\tgit reset --hard &&\n+\tgit checkout -b test$test_count branch1 &&\n+\tgit submodule update -N &&\n \t(\n \t\tcd subdir &&\n+\t\ttest_must_fail git merge master >/dev/null 2>&1 &&\n+\t\t( yes \"\" | git mergetool file3 >/dev/null 2>&1 ) &&\n \t\t( yes \"\" | git mergetool ../file1 >/dev/null 2>&1 ) &&\n \t\t( yes \"\" | git mergetool ../file2 ../spaced\\ name >/dev/null 2>&1 ) &&\n \t\t( yes \"\" | git mergetool ../both >/dev/null 2>&1 ) &&\n@@ -161,6 +169,7 @@ test_expect_success 'mergetool on file in parent dir' '\n '\n \n test_expect_success 'mergetool skips autoresolved' '\n+\tgit reset --hard &&\n \tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \ttest_must_fail git merge master &&\n@@ -174,6 +183,8 @@ test_expect_success 'mergetool skips autoresolved' '\n '\n \n test_expect_success 'mergetool merges all from subdir' '\n+\tgit reset --hard &&\n+\tgit checkout -b test$test_count branch1 &&\n \ttest_config rerere.enabled false &&\n \t(\n \t\tcd subdir &&\n@@ -190,6 +201,7 @@ test_expect_success 'mergetool merges all from subdir' '\n '\n \n test_expect_success 'mergetool skips resolved paths when rerere is active' '\n+\tgit reset --hard &&\n \ttest_config rerere.enabled true &&\n \trm -rf .git/rr-cache &&\n \tgit checkout -b test$test_count branch1 &&\n@@ -204,6 +216,7 @@ test_expect_success 'mergetool skips resolved paths when rerere is active' '\n '\n \n test_expect_success 'conflicted stash sets up rerere'  '\n+\tgit reset --hard &&\n \ttest_config rerere.enabled true &&\n \tgit checkout stash1 &&\n \techo \"Conflicting stash content\" >file11 &&\n@@ -244,6 +257,7 @@ test_expect_success 'mergetool takes partial path' '\n '\n \n test_expect_success 'mergetool delete/delete conflict' '\n+\tgit reset --hard &&\n \tgit checkout -b delete-base branch1 &&\n \tmkdir -p a/a &&\n \t(echo one; echo two; echo 3; echo 4) >a/a/file.txt &&\n@@ -274,6 +288,7 @@ test_expect_success 'mergetool delete/delete conflict' '\n '\n \n test_expect_success 'mergetool produces no errors when keepBackup is used' '\n+\tgit reset --hard &&\n \ttest_config mergetool.keepBackup true &&\n \ttest_must_fail git merge move-to-b &&\n \t: >expect &&\n@@ -284,6 +299,7 @@ test_expect_success 'mergetool produces no errors when keepBackup is used' '\n '\n \n test_expect_success 'mergetool honors tempfile config for deleted files' '\n+\tgit reset --hard &&\n \ttest_config mergetool.keepTemporaries false &&\n \ttest_must_fail git merge move-to-b &&\n \techo d | git mergetool a/a/file.txt &&\n@@ -292,6 +308,7 @@ test_expect_success 'mergetool honors tempfile config for deleted files' '\n '\n \n test_expect_success 'mergetool keeps tempfiles when aborting delete/delete' '\n+\tgit reset --hard &&\n \ttest_config mergetool.keepTemporaries true &&\n \ttest_must_fail git merge move-to-b &&\n \t! (echo a; echo n) | git mergetool a/a/file.txt &&\n@@ -308,6 +325,7 @@ test_expect_success 'mergetool keeps tempfiles when aborting delete/delete' '\n '\n \n test_expect_success 'deleted vs modified submodule' '\n+\tgit reset --hard &&\n \tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \tmv submod submod-movedaside &&\n@@ -377,6 +395,7 @@ test_expect_success 'deleted vs modified submodule' '\n '\n \n test_expect_success 'file vs modified submodule' '\n+\tgit reset --hard &&\n \tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \tmv submod submod-movedaside &&\n@@ -448,6 +467,7 @@ test_expect_success 'file vs modified submodule' '\n '\n \n test_expect_success 'submodule in subdirectory' '\n+\tgit reset --hard &&\n \tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \t(\n@@ -509,6 +529,7 @@ test_expect_success 'submodule in subdirectory' '\n '\n \n test_expect_success 'directory vs modified submodule' '\n+\tgit reset --hard &&\n \tgit checkout -b test$test_count branch1 &&\n \tmv submod submod-movedaside &&\n \tgit rm --cached submod &&\n@@ -559,6 +580,7 @@ test_expect_success 'directory vs modified submodule' '\n '\n \n test_expect_success 'file with no base' '\n+\tgit reset --hard &&\n \tgit checkout -b test$test_count branch1 &&\n \ttest_must_fail git merge master &&\n \tgit mergetool --no-prompt --tool mybase -- both &&\n@@ -568,6 +590,7 @@ test_expect_success 'file with no base' '\n '\n \n test_expect_success 'custom commands override built-ins' '\n+\tgit reset --hard &&\n \tgit checkout -b test$test_count branch1 &&\n \ttest_config mergetool.defaults.cmd \"cat \\\"\\$REMOTE\\\" >\\\"\\$MERGED\\\"\" &&\n \ttest_config mergetool.defaults.trustExitCode true &&\n@@ -579,6 +602,7 @@ test_expect_success 'custom commands override built-ins' '\n '\n \n test_expect_success 'filenames seen by tools start with ./' '\n+\tgit reset --hard &&\n \tgit checkout -b test$test_count branch1 &&\n \ttest_config mergetool.writeToTemp false &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n@@ -595,6 +619,7 @@ test_lazy_prereq MKTEMP '\n '\n \n test_expect_success MKTEMP 'temporary filenames are used with mergetool.writeToTemp' '\n+\tgit reset --hard &&\n \tgit checkout -b test$test_count branch1 &&\n \ttest_config mergetool.writeToTemp true &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n@@ -607,6 +632,7 @@ test_expect_success MKTEMP 'temporary filenames are used with mergetool.writeToT\n '\n \n test_expect_success 'diff.orderFile configuration is honored' '\n+\tgit reset --hard &&\n \ttest_config diff.orderFile order-file &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n \ttest_config mergetool.myecho.trustExitCode true &&\n@@ -639,6 +665,7 @@ test_expect_success 'diff.orderFile configuration is honored' '\n \tgit reset --hard >/dev/null\n '\n test_expect_success 'mergetool -Oorder-file is honored' '\n+\tgit reset --hard &&\n \ttest_config diff.orderFile order-file &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n \ttest_config mergetool.myecho.trustExitCode true &&\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"308748","messageId":"20170104005042.51530-4-hansenr@google.com","threadId":"44811","inReplyTo":"20170104005042.51530-1-hansenr@google.com","subject":"[PATCH 3/4] t7610: add test case for rerere+mergetool+subdir bug","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-04T00:50:41Z","receivedAt":"2017-01-04T00:58:48Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"If rerere is enabled and mergetool is run from a subdirectory,\nmergetool always prints \"No files need merging\".  Add an expected\nfailure test case for this situation.\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n t/t7610-mergetool.sh | 21 ++++++++++++++++++++-\n 1 file changed, 20 insertions(+), 1 deletion(-)\n\ndiff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh\nindex 8e2b4e147..e7b3e1866 100755\n--- a/t/t7610-mergetool.sh\n+++ b/t/t7610-mergetool.sh\n@@ -182,7 +182,7 @@ test_expect_success 'mergetool skips autoresolved' '\n \tgit reset --hard\n '\n \n-test_expect_success 'mergetool merges all from subdir' '\n+test_expect_success 'mergetool merges all from subdir (rerere disabled)' '\n \tgit reset --hard &&\n \tgit checkout -b test$test_count branch1 &&\n \ttest_config rerere.enabled false &&\n@@ -200,6 +200,25 @@ test_expect_success 'mergetool merges all from subdir' '\n \t)\n '\n \n+test_expect_failure 'mergetool merges all from subdir (rerere enabled)' '\n+\tgit reset --hard &&\n+\tgit checkout -b test$test_count branch1 &&\n+\ttest_config rerere.enabled true &&\n+\trm -rf .git/rr-cache &&\n+\t(\n+\t\tcd subdir &&\n+\t\ttest_must_fail git merge master &&\n+\t\t( yes \"r\" | git mergetool ../submod ) &&\n+\t\t( yes \"d\" \"d\" | git mergetool --no-prompt ) &&\n+\t\ttest \"$(cat ../file1)\" = \"master updated\" &&\n+\t\ttest \"$(cat ../file2)\" = \"master new\" &&\n+\t\ttest \"$(cat file3)\" = \"master new sub\" &&\n+\t\t( cd .. && git submodule update -N ) &&\n+\t\ttest \"$(cat ../submod/bar)\" = \"master submodule\" &&\n+\t\tgit commit -m \"branch2 resolved by mergetool from subdir\"\n+\t)\n+'\n+\n test_expect_success 'mergetool skips resolved paths when rerere is active' '\n \tgit reset --hard &&\n \ttest_config rerere.enabled true &&\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"308749","messageId":"20170104005042.51530-2-hansenr@google.com","threadId":"44811","inReplyTo":"20170104005042.51530-1-hansenr@google.com","subject":"[PATCH 1/4] t7610: update branch names to match test number","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-04T00:50:39Z","receivedAt":"2017-01-04T00:59:48Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"Rename the testNN branches so that NN matches the test number.  This\nshould make it easier to troubleshoot test issues.  Use $test_count to\nkeep this future-proof.\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n t/t7610-mergetool.sh | 82 ++++++++++++++++++++++++++--------------------------\n 1 file changed, 41 insertions(+), 41 deletions(-)\n\ndiff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh\nindex 6d9f21511..14090739f 100755\n--- a/t/t7610-mergetool.sh\n+++ b/t/t7610-mergetool.sh\n@@ -94,7 +94,7 @@ test_expect_success 'setup' '\n '\n \n test_expect_success 'custom mergetool' '\n-\tgit checkout -b test1 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \ttest_must_fail git merge master >/dev/null 2>&1 &&\n \t( yes \"\" | git mergetool both >/dev/null 2>&1 ) &&\n@@ -113,7 +113,7 @@ test_expect_success 'custom mergetool' '\n \n test_expect_success 'mergetool crlf' '\n \ttest_config core.autocrlf true &&\n-\tgit checkout -b test2 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \ttest_must_fail git merge master >/dev/null 2>&1 &&\n \t( yes \"\" | git mergetool file1 >/dev/null 2>&1 ) &&\n \t( yes \"\" | git mergetool file2 >/dev/null 2>&1 ) &&\n@@ -134,7 +134,7 @@ test_expect_success 'mergetool crlf' '\n '\n \n test_expect_success 'mergetool in subdir' '\n-\tgit checkout -b test3 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \t(\n \t\tcd subdir &&\n@@ -161,7 +161,7 @@ test_expect_success 'mergetool on file in parent dir' '\n '\n \n test_expect_success 'mergetool skips autoresolved' '\n-\tgit checkout -b test4 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \ttest_must_fail git merge master &&\n \ttest -n \"$(git ls-files -u)\" &&\n@@ -192,7 +192,7 @@ test_expect_success 'mergetool merges all from subdir' '\n test_expect_success 'mergetool skips resolved paths when rerere is active' '\n \ttest_config rerere.enabled true &&\n \trm -rf .git/rr-cache &&\n-\tgit checkout -b test5 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \ttest_must_fail git merge master >/dev/null 2>&1 &&\n \t( yes \"l\" | git mergetool --no-prompt submod >/dev/null 2>&1 ) &&\n@@ -233,7 +233,7 @@ test_expect_success 'conflicted stash sets up rerere'  '\n test_expect_success 'mergetool takes partial path' '\n \tgit reset --hard &&\n \ttest_config rerere.enabled false &&\n-\tgit checkout -b test12 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \ttest_must_fail git merge master &&\n \n@@ -308,12 +308,12 @@ test_expect_success 'mergetool keeps tempfiles when aborting delete/delete' '\n '\n \n test_expect_success 'deleted vs modified submodule' '\n-\tgit checkout -b test6 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \tmv submod submod-movedaside &&\n \tgit rm --cached submod &&\n \tgit commit -m \"Submodule deleted from branch\" &&\n-\tgit checkout -b test6.a test6 &&\n+\tgit checkout -b test$test_count.a test$test_count &&\n \ttest_must_fail git merge master &&\n \ttest -n \"$(git ls-files -u)\" &&\n \t( yes \"\" | git mergetool file1 file2 spaced\\ name subdir/file3 >/dev/null 2>&1 ) &&\n@@ -329,7 +329,7 @@ test_expect_success 'deleted vs modified submodule' '\n \tgit commit -m \"Merge resolved by keeping module\" &&\n \n \tmv submod submod-movedaside &&\n-\tgit checkout -b test6.b test6 &&\n+\tgit checkout -b test$test_count.b test$test_count &&\n \tgit submodule update -N &&\n \ttest_must_fail git merge master &&\n \ttest -n \"$(git ls-files -u)\" &&\n@@ -343,9 +343,9 @@ test_expect_success 'deleted vs modified submodule' '\n \tgit commit -m \"Merge resolved by deleting module\" &&\n \n \tmv submod-movedaside submod &&\n-\tgit checkout -b test6.c master &&\n+\tgit checkout -b test$test_count.c master &&\n \tgit submodule update -N &&\n-\ttest_must_fail git merge test6 &&\n+\ttest_must_fail git merge test$test_count &&\n \ttest -n \"$(git ls-files -u)\" &&\n \t( yes \"\" | git mergetool file1 file2 spaced\\ name subdir/file3 >/dev/null 2>&1 ) &&\n \t( yes \"\" | git mergetool both >/dev/null 2>&1 ) &&\n@@ -359,9 +359,9 @@ test_expect_success 'deleted vs modified submodule' '\n \tgit commit -m \"Merge resolved by deleting module\" &&\n \tmv submod.orig submod &&\n \n-\tgit checkout -b test6.d master &&\n+\tgit checkout -b test$test_count.d master &&\n \tgit submodule update -N &&\n-\ttest_must_fail git merge test6 &&\n+\ttest_must_fail git merge test$test_count &&\n \ttest -n \"$(git ls-files -u)\" &&\n \t( yes \"\" | git mergetool file1 file2 spaced\\ name subdir/file3 >/dev/null 2>&1 ) &&\n \t( yes \"\" | git mergetool both >/dev/null 2>&1 ) &&\n@@ -377,14 +377,14 @@ test_expect_success 'deleted vs modified submodule' '\n '\n \n test_expect_success 'file vs modified submodule' '\n-\tgit checkout -b test7 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \tmv submod submod-movedaside &&\n \tgit rm --cached submod &&\n \techo not a submodule >submod &&\n \tgit add submod &&\n \tgit commit -m \"Submodule path becomes file\" &&\n-\tgit checkout -b test7.a branch1 &&\n+\tgit checkout -b test$test_count.a branch1 &&\n \ttest_must_fail git merge master &&\n \ttest -n \"$(git ls-files -u)\" &&\n \t( yes \"\" | git mergetool file1 file2 spaced\\ name subdir/file3 >/dev/null 2>&1 ) &&\n@@ -400,7 +400,7 @@ test_expect_success 'file vs modified submodule' '\n \tgit commit -m \"Merge resolved by keeping module\" &&\n \n \tmv submod submod-movedaside &&\n-\tgit checkout -b test7.b test7 &&\n+\tgit checkout -b test$test_count.b test$test_count &&\n \ttest_must_fail git merge master &&\n \ttest -n \"$(git ls-files -u)\" &&\n \t( yes \"\" | git mergetool file1 file2 spaced\\ name subdir/file3 >/dev/null 2>&1 ) &&\n@@ -413,11 +413,11 @@ test_expect_success 'file vs modified submodule' '\n \ttest \"$output\" = \"No files need merging\" &&\n \tgit commit -m \"Merge resolved by keeping file\" &&\n \n-\tgit checkout -b test7.c master &&\n+\tgit checkout -b test$test_count.c master &&\n \trmdir submod && mv submod-movedaside submod &&\n \ttest ! -e submod.orig &&\n \tgit submodule update -N &&\n-\ttest_must_fail git merge test7 &&\n+\ttest_must_fail git merge test$test_count &&\n \ttest -n \"$(git ls-files -u)\" &&\n \t( yes \"\" | git mergetool file1 file2 spaced\\ name subdir/file3 >/dev/null 2>&1 ) &&\n \t( yes \"\" | git mergetool both >/dev/null 2>&1 ) &&\n@@ -430,10 +430,10 @@ test_expect_success 'file vs modified submodule' '\n \ttest \"$output\" = \"No files need merging\" &&\n \tgit commit -m \"Merge resolved by keeping file\" &&\n \n-\tgit checkout -b test7.d master &&\n+\tgit checkout -b test$test_count.d master &&\n \trmdir submod && mv submod.orig submod &&\n \tgit submodule update -N &&\n-\ttest_must_fail git merge test7 &&\n+\ttest_must_fail git merge test$test_count &&\n \ttest -n \"$(git ls-files -u)\" &&\n \t( yes \"\" | git mergetool file1 file2 spaced\\ name subdir/file3 >/dev/null 2>&1 ) &&\n \t( yes \"\" | git mergetool both>/dev/null 2>&1 ) &&\n@@ -448,7 +448,7 @@ test_expect_success 'file vs modified submodule' '\n '\n \n test_expect_success 'submodule in subdirectory' '\n-\tgit checkout -b test10 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \t(\n \t\tcd subdir &&\n@@ -464,52 +464,52 @@ test_expect_success 'submodule in subdirectory' '\n \tgit add subdir/subdir_module &&\n \tgit commit -m \"add submodule in subdirectory\" &&\n \n-\tgit checkout -b test10.a test10 &&\n+\tgit checkout -b test$test_count.a test$test_count &&\n \tgit submodule update -N &&\n \t(\n \tcd subdir/subdir_module &&\n \t\tgit checkout -b super10.a &&\n-\t\techo test10.a >file15 &&\n+\t\techo test$test_count.a >file15 &&\n \t\tgit add file15 &&\n \t\tgit commit -m \"on branch 10.a\"\n \t) &&\n \tgit add subdir/subdir_module &&\n-\tgit commit -m \"change submodule in subdirectory on test10.a\" &&\n+\tgit commit -m \"change submodule in subdirectory on test$test_count.a\" &&\n \n-\tgit checkout -b test10.b test10 &&\n+\tgit checkout -b test$test_count.b test$test_count &&\n \tgit submodule update -N &&\n \t(\n \t\tcd subdir/subdir_module &&\n \t\tgit checkout -b super10.b &&\n-\t\techo test10.b >file15 &&\n+\t\techo test$test_count.b >file15 &&\n \t\tgit add file15 &&\n \t\tgit commit -m \"on branch 10.b\"\n \t) &&\n \tgit add subdir/subdir_module &&\n-\tgit commit -m \"change submodule in subdirectory on test10.b\" &&\n+\tgit commit -m \"change submodule in subdirectory on test$test_count.b\" &&\n \n-\ttest_must_fail git merge test10.a >/dev/null 2>&1 &&\n+\ttest_must_fail git merge test$test_count.a >/dev/null 2>&1 &&\n \t(\n \t\tcd subdir &&\n \t\t( yes \"l\" | git mergetool subdir_module )\n \t) &&\n-\ttest \"$(cat subdir/subdir_module/file15)\" = \"test10.b\" &&\n+\ttest \"$(cat subdir/subdir_module/file15)\" = \"test$test_count.b\" &&\n \tgit submodule update -N &&\n-\ttest \"$(cat subdir/subdir_module/file15)\" = \"test10.b\" &&\n+\ttest \"$(cat subdir/subdir_module/file15)\" = \"test$test_count.b\" &&\n \tgit reset --hard &&\n \tgit submodule update -N &&\n \n-\ttest_must_fail git merge test10.a >/dev/null 2>&1 &&\n+\ttest_must_fail git merge test$test_count.a >/dev/null 2>&1 &&\n \t( yes \"r\" | git mergetool subdir/subdir_module ) &&\n-\ttest \"$(cat subdir/subdir_module/file15)\" = \"test10.b\" &&\n+\ttest \"$(cat subdir/subdir_module/file15)\" = \"test$test_count.b\" &&\n \tgit submodule update -N &&\n-\ttest \"$(cat subdir/subdir_module/file15)\" = \"test10.a\" &&\n+\ttest \"$(cat subdir/subdir_module/file15)\" = \"test$test_count.a\" &&\n \tgit commit -m \"branch1 resolved with mergetool\" &&\n \trm -rf subdir/subdir_module\n '\n \n test_expect_success 'directory vs modified submodule' '\n-\tgit checkout -b test11 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \tmv submod submod-movedaside &&\n \tgit rm --cached submod &&\n \tmkdir submod &&\n@@ -537,9 +537,9 @@ test_expect_success 'directory vs modified submodule' '\n \ttest \"$(cat submod/bar)\" = \"master submodule\" &&\n \tgit reset --hard >/dev/null 2>&1 && rm -rf submod-movedaside &&\n \n-\tgit checkout -b test11.c master &&\n+\tgit checkout -b test$test_count.c master &&\n \tgit submodule update -N &&\n-\ttest_must_fail git merge test11 &&\n+\ttest_must_fail git merge test$test_count &&\n \ttest -n \"$(git ls-files -u)\" &&\n \t( yes \"l\" | git mergetool submod ) &&\n \tgit submodule update -N &&\n@@ -547,7 +547,7 @@ test_expect_success 'directory vs modified submodule' '\n \n \tgit reset --hard >/dev/null 2>&1 &&\n \tgit submodule update -N &&\n-\ttest_must_fail git merge test11 &&\n+\ttest_must_fail git merge test$test_count &&\n \ttest -n \"$(git ls-files -u)\" &&\n \ttest ! -e submod.orig &&\n \t( yes \"r\" | git mergetool submod ) &&\n@@ -559,7 +559,7 @@ test_expect_success 'directory vs modified submodule' '\n '\n \n test_expect_success 'file with no base' '\n-\tgit checkout -b test13 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \ttest_must_fail git merge master &&\n \tgit mergetool --no-prompt --tool mybase -- both &&\n \t>expected &&\n@@ -568,7 +568,7 @@ test_expect_success 'file with no base' '\n '\n \n test_expect_success 'custom commands override built-ins' '\n-\tgit checkout -b test14 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \ttest_config mergetool.defaults.cmd \"cat \\\"\\$REMOTE\\\" >\\\"\\$MERGED\\\"\" &&\n \ttest_config mergetool.defaults.trustExitCode true &&\n \ttest_must_fail git merge master &&\n@@ -579,7 +579,7 @@ test_expect_success 'custom commands override built-ins' '\n '\n \n test_expect_success 'filenames seen by tools start with ./' '\n-\tgit checkout -b test15 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \ttest_config mergetool.writeToTemp false &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n \ttest_config mergetool.myecho.trustExitCode true &&\n@@ -595,7 +595,7 @@ test_lazy_prereq MKTEMP '\n '\n \n test_expect_success MKTEMP 'temporary filenames are used with mergetool.writeToTemp' '\n-\tgit checkout -b test16 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \ttest_config mergetool.writeToTemp true &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n \ttest_config mergetool.myecho.trustExitCode true &&\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"308750","messageId":"20170104005042.51530-5-hansenr@google.com","threadId":"44811","inReplyTo":"20170104005042.51530-1-hansenr@google.com","subject":"[PATCH 4/4] mergetool: fix running in subdir when rerere enabled","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-04T00:50:42Z","receivedAt":"2017-01-04T01:00:04Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"If rerere is enabled and no pathnames are given, run cd_to_toplevel\nbefore running 'git diff --name-only' so that 'git diff --name-only'\nsees the pathnames emitted by 'git rerere remaining'.\n\nAlso run cd_to_toplevel before running 'git rerere remaining' in case\n'git rerere remaining' is ever changed to print pathnames relative to\nthe current directory rather than to $GIT_WORK_TREE.\n\nThis fixes a regression introduced in\n57937f70a09c12ef484c290865dac4066d207c9c (v2.11.0).\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n git-mergetool.sh     | 1 +\n t/t7610-mergetool.sh | 2 +-\n 2 files changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/git-mergetool.sh b/git-mergetool.sh\nindex e52b4e4f2..67ea0d6db 100755\n--- a/git-mergetool.sh\n+++ b/git-mergetool.sh\n@@ -456,6 +456,7 @@ main () {\n \n \tif test $# -eq 0 && test -e \"$GIT_DIR/MERGE_RR\"\n \tthen\n+\t\tcd_to_toplevel\n \t\tset -- $(git rerere remaining)\n \t\tif test $# -eq 0\n \t\tthen\ndiff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh\nindex e7b3e1866..1f7d63acb 100755\n--- a/t/t7610-mergetool.sh\n+++ b/t/t7610-mergetool.sh\n@@ -200,7 +200,7 @@ test_expect_success 'mergetool merges all from subdir (rerere disabled)' '\n \t)\n '\n \n-test_expect_failure 'mergetool merges all from subdir (rerere enabled)' '\n+test_expect_success 'mergetool merges all from subdir (rerere enabled)' '\n \tgit reset --hard &&\n \tgit checkout -b test$test_count branch1 &&\n \ttest_config rerere.enabled true &&\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"308751","messageId":"20170104005042.51530-1-hansenr@google.com","threadId":"44811","inReplyTo":null,"subject":"[PATCH 0/4] fix mergetool+rerere+subdir regression","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-04T00:50:38Z","receivedAt":"2017-01-04T01:00:48Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"If rerere is enabled, no pathnames are given, and mergetool is run\nfrom a subdirectory, mergetool always prints \"No files need merging\".\nFix the bug.\n\nThis regression was introduced in\n57937f70a09c12ef484c290865dac4066d207c9c (v2.11.0).\n\nRichard Hansen (4):\n  t7610: update branch names to match test number\n  t7610: make tests more independent and debuggable\n  t7610: add test case for rerere+mergetool+subdir bug\n  mergetool: fix running in subdir when rerere enabled\n\n git-mergetool.sh     |   1 +\n t/t7610-mergetool.sh | 132 ++++++++++++++++++++++++++++++++++-----------------\n 2 files changed, 90 insertions(+), 43 deletions(-)\n\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"308798","messageId":"CAGZ79kb9UvV6AaRLBP5OzyRtTTXarRZRZDMd_1k5n9CrgbVr5A@mail.gmail.com","threadId":"44811","inReplyTo":"20170104005042.51530-3-hansenr@google.com","subject":"Re: [PATCH 2/4] t7610: make tests more independent and debuggable","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2017-01-04T20:27:45Z","receivedAt":"2017-01-04T20:28:41Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Tue, Jan 3, 2017 at 4:50 PM, Richard Hansen <hansenr@google.com> wrote:\n> If a test fails it might leave the repository in a strange state.  Add\n> 'git reset --hard' at the beginning of each test to increase the odds\n> of passing when an earlier test fails.\n\nSo each test is cleaning up the previous test, which *may* confuse\na reader (\"how is the reset --hard relevant for this test? Oooh it's\njust a cleanup\").\n\nWe could put it another way by having each test itself make clean\nup after itself via\n\n  test_when_finished \"git reset --hard\" &&\n  ..\n\nat the beginning of each test.\nThis would produce the same order of operations, i.e. a\nreset run between each test, but semantically tells the reader\nthat the reset is part of the current test cleaning up after itself,\nas \"reset\" is operation for this particular test to cleanup.\nDoes that make sense?\n\n\n>\n> Also use test-specific branches to avoid interfering with later tests\n> and to make the tests easier to debug.\n\nThat sounds great!\nThough in the code I only spot one occurrence for\n\n+       git checkout -b test$test_count branch1 &&\n\nso maybe that could be part of the first patch in the series?\n\nThanks,\nStefan\n"},{"id":"308818","messageId":"20170105122037.t4k7cby6klqb4lci@ruderich.org","threadId":"44811","inReplyTo":"20170104005042.51530-3-hansenr@google.com","subject":"Re: [PATCH 2/4] t7610: make tests more independent and debuggable","fromName":"Simon Ruderich","fromEmail":"simon@ruderich.org","sentAt":"2017-01-05T12:20:37Z","receivedAt":"2017-01-05T12:25:49Z","isPatch":true,"sender":{"key":"simon@ruderich.org","avatar":"https://avatars.githubusercontent.com/u/390994?v=4"},"body":"On Tue, Jan 03, 2017 at 07:50:40PM -0500, Richard Hansen wrote:\n> [snip]\n> @@ -145,8 +148,13 @@ test_expect_success 'mergetool in subdir' '\n>  '\n>\n>  test_expect_success 'mergetool on file in parent dir' '\n> +\tgit reset --hard &&\n> +\tgit checkout -b test$test_count branch1 &&\n> +\tgit submodule update -N &&\n>  \t(\n>  \t\tcd subdir &&\n> +\t\ttest_must_fail git merge master >/dev/null 2>&1 &&\n> +\t\t( yes \"\" | git mergetool file3 >/dev/null 2>&1 ) &&\n\nThis change seems unrelated to the changes mentioned in the\ncommit message. Was it intended?\n\nRegards\nSimon\n-- \n+ privacy is necessary\n+ using gnupg http://gnupg.org\n+ public key id: 0x92FEFDB7E44C32F9\n"},{"id":"308823","messageId":"50fb1887-c6c6-9ec9-8d6c-fc4c6193bd98@google.com","threadId":"44811","inReplyTo":"CAGZ79kb9UvV6AaRLBP5OzyRtTTXarRZRZDMd_1k5n9CrgbVr5A@mail.gmail.com","subject":"Re: [PATCH 2/4] t7610: make tests more independent and debuggable","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-05T15:46:07Z","receivedAt":"2017-01-05T15:46:15Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"\n\nOn 2017-01-04 15:27, Stefan Beller wrote:\n> On Tue, Jan 3, 2017 at 4:50 PM, Richard Hansen <hansenr@google.com> wrote:\n>> If a test fails it might leave the repository in a strange state.  Add\n>> 'git reset --hard' at the beginning of each test to increase the odds\n>> of passing when an earlier test fails.\n>\n> So each test is cleaning up the previous test, which *may* confuse\n> a reader (\"how is the reset --hard relevant for this test? Oooh it's\n> just a cleanup\").\n>\n> We could put it another way by having each test itself make clean\n> up after itself via\n>\n>   test_when_finished \"git reset --hard\" &&\n>   ..\n>\n> at the beginning of each test.\n> This would produce the same order of operations, i.e. a\n> reset run between each test, but semantically tells the reader\n> that the reset is part of the current test cleaning up after itself,\n> as \"reset\" is operation for this particular test to cleanup.\n> Does that make sense?\n\nI like that idea; thanks for the suggestion.  I'll cook up a reroll.\n\n>>\n>> Also use test-specific branches to avoid interfering with later tests\n>> and to make the tests easier to debug.\n>\n> That sounds great!\n> Though in the code I only spot one occurrence for\n>\n> +       git checkout -b test$test_count branch1 &&\n>\n> so maybe that could be part of the first patch in the series?\n\nThere are two; the other is buried in the change for the 'mergetool on \nfile in parent dir' test.  I'll improve the commit message to make it \nmore clear.\n\nThanks for the review,\nRichard\n\n\n>\n> Thanks,\n> Stefan\n"},{"id":"308824","messageId":"bf3fcea5-9507-018b-d67b-70ce208a8677@google.com","threadId":"44811","inReplyTo":"20170105122037.t4k7cby6klqb4lci@ruderich.org","subject":"Re: [PATCH 2/4] t7610: make tests more independent and debuggable","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-05T15:48:31Z","receivedAt":"2017-01-05T15:48:38Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"\n\nOn 2017-01-05 07:20, Simon Ruderich wrote:\n> On Tue, Jan 03, 2017 at 07:50:40PM -0500, Richard Hansen wrote:\n>> [snip]\n>> @@ -145,8 +148,13 @@ test_expect_success 'mergetool in subdir' '\n>>  '\n>>\n>>  test_expect_success 'mergetool on file in parent dir' '\n>> +\tgit reset --hard &&\n>> +\tgit checkout -b test$test_count branch1 &&\n>> +\tgit submodule update -N &&\n>>  \t(\n>>  \t\tcd subdir &&\n>> +\t\ttest_must_fail git merge master >/dev/null 2>&1 &&\n>> +\t\t( yes \"\" | git mergetool file3 >/dev/null 2>&1 ) &&\n>\n> This change seems unrelated to the changes mentioned in the\n> commit message. Was it intended?\n\nYes, that is intentional; without this change, the test depends on the \nsuccessful completion of the previous test.  I'll improve the commit \nmessage.\n\nThanks,\nRichard\n\n>\n> Regards\n> Simon\n"},{"id":"308825","messageId":"3f0222d0-fc61-ac41-3b1d-7f506fcb1f61@scientician.org","threadId":"44811","inReplyTo":"CAGZ79kb9UvV6AaRLBP5OzyRtTTXarRZRZDMd_1k5n9CrgbVr5A@mail.gmail.com","subject":"Re: [PATCH 2/4] t7610: make tests more independent and debuggable","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-05T15:41:58Z","receivedAt":"2017-01-05T15:49:24Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"On 2017-01-04 15:27, Stefan Beller wrote:\n> On Tue, Jan 3, 2017 at 4:50 PM, Richard Hansen <hansenr@google.com> wrote:\n>> If a test fails it might leave the repository in a strange state.  Add\n>> 'git reset --hard' at the beginning of each test to increase the odds\n>> of passing when an earlier test fails.\n>\n> So each test is cleaning up the previous test, which *may* confuse\n> a reader (\"how is the reset --hard relevant for this test? Oooh it's\n> just a cleanup\").\n>\n> We could put it another way by having each test itself make clean\n> up after itself via\n>\n>   test_when_finished \"git reset --hard\" &&\n>   ..\n>\n> at the beginning of each test.\n> This would produce the same order of operations, i.e. a\n> reset run between each test, but semantically tells the reader\n> that the reset is part of the current test cleaning up after itself,\n> as \"reset\" is operation for this particular test to cleanup.\n> Does that make sense?\n\nI like that idea; thanks for the suggestion.  I'll cook up a reroll.\n\n>>\n>> Also use test-specific branches to avoid interfering with later tests\n>> and to make the tests easier to debug.\n>\n> That sounds great!\n> Though in the code I only spot one occurrence for\n>\n> +       git checkout -b test$test_count branch1 &&\n>\n> so maybe that could be part of the first patch in the series?\n\nThere are two; the other is buried in the change for the 'mergetool on \nfile in parent dir' test.\n\nThanks for the review,\nRichard\n\n\n>\n> Thanks,\n> Stefan\n\n"},{"id":"308832","messageId":"20170106010945.79382-1-hansenr@google.com","threadId":"44811","inReplyTo":"20170104005042.51530-1-hansenr@google.com","subject":"[PATCH v2 0/4] fix mergetool+rerere+subdir regression","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-06T01:09:41Z","receivedAt":"2017-01-06T01:10:37Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"If rerere is enabled, no pathnames are given, and mergetool is run\nfrom a subdirectory, mergetool always prints \"No files need merging\".\nFix the bug.\n\nThis regression was introduced in\n57937f70a09c12ef484c290865dac4066d207c9c (v2.11.0).\n\nChanges since v1:\n  * Patch 2/4 was reworked to improve the commit message, improve test\n    case independence even further, and use 'test_when_finished \"git\n    reset --hard\"' instead of a plain 'git reset --hard'.\n\nRichard Hansen (4):\n  t7610: update branch names to match test number\n  t7610: make tests more independent and debuggable\n  t7610: add test case for rerere+mergetool+subdir bug\n  mergetool: fix running in subdir when rerere enabled\n\n git-mergetool.sh     |   1 +\n t/t7610-mergetool.sh | 251 ++++++++++++++++++++++++++++++---------------------\n 2 files changed, 147 insertions(+), 105 deletions(-)\n\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"308833","messageId":"20170106010945.79382-5-hansenr@google.com","threadId":"44811","inReplyTo":"20170106010945.79382-1-hansenr@google.com","subject":"[PATCH v2 4/4] mergetool: fix running in subdir when rerere enabled","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-06T01:09:45Z","receivedAt":"2017-01-06T01:11:04Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"If rerere is enabled and no pathnames are given, run cd_to_toplevel\nbefore running 'git diff --name-only' so that 'git diff --name-only'\nsees the pathnames emitted by 'git rerere remaining'.\n\nAlso run cd_to_toplevel before running 'git rerere remaining' in case\n'git rerere remaining' is ever changed to print pathnames relative to\nthe current directory rather than to $GIT_WORK_TREE.\n\nThis fixes a regression introduced in\n57937f70a09c12ef484c290865dac4066d207c9c (v2.11.0).\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n git-mergetool.sh     | 1 +\n t/t7610-mergetool.sh | 2 +-\n 2 files changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/git-mergetool.sh b/git-mergetool.sh\nindex e52b4e4f2..67ea0d6db 100755\n--- a/git-mergetool.sh\n+++ b/git-mergetool.sh\n@@ -456,6 +456,7 @@ main () {\n \n \tif test $# -eq 0 && test -e \"$GIT_DIR/MERGE_RR\"\n \tthen\n+\t\tcd_to_toplevel\n \t\tset -- $(git rerere remaining)\n \t\tif test $# -eq 0\n \t\tthen\ndiff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh\nindex 1cef1ec2e..5d76772cf 100755\n--- a/t/t7610-mergetool.sh\n+++ b/t/t7610-mergetool.sh\n@@ -231,7 +231,7 @@ test_expect_success 'mergetool merges all from subdir (rerere disabled)' '\n \t)\n '\n \n-test_expect_failure 'mergetool merges all from subdir (rerere enabled)' '\n+test_expect_success 'mergetool merges all from subdir (rerere enabled)' '\n \ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \ttest_config rerere.enabled true &&\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"308834","messageId":"20170106010945.79382-4-hansenr@google.com","threadId":"44811","inReplyTo":"20170106010945.79382-1-hansenr@google.com","subject":"[PATCH v2 3/4] t7610: add test case for rerere+mergetool+subdir bug","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-06T01:09:44Z","receivedAt":"2017-01-06T01:11:07Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"If rerere is enabled and mergetool is run from a subdirectory,\nmergetool always prints \"No files need merging\".  Add an expected\nfailure test case for this situation.\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n t/t7610-mergetool.sh | 21 ++++++++++++++++++++-\n 1 file changed, 20 insertions(+), 1 deletion(-)\n\ndiff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh\nindex 2c06cf73f..1cef1ec2e 100755\n--- a/t/t7610-mergetool.sh\n+++ b/t/t7610-mergetool.sh\n@@ -213,7 +213,7 @@ test_expect_success 'mergetool skips autoresolved' '\n \ttest \"$output\" = \"No files need merging\"\n '\n \n-test_expect_success 'mergetool merges all from subdir' '\n+test_expect_success 'mergetool merges all from subdir (rerere disabled)' '\n \ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \ttest_config rerere.enabled false &&\n@@ -231,6 +231,25 @@ test_expect_success 'mergetool merges all from subdir' '\n \t)\n '\n \n+test_expect_failure 'mergetool merges all from subdir (rerere enabled)' '\n+\ttest_when_finished \"git reset --hard\" &&\n+\tgit checkout -b test$test_count branch1 &&\n+\ttest_config rerere.enabled true &&\n+\trm -rf .git/rr-cache &&\n+\t(\n+\t\tcd subdir &&\n+\t\ttest_must_fail git merge master &&\n+\t\t( yes \"r\" | git mergetool ../submod ) &&\n+\t\t( yes \"d\" \"d\" | git mergetool --no-prompt ) &&\n+\t\ttest \"$(cat ../file1)\" = \"master updated\" &&\n+\t\ttest \"$(cat ../file2)\" = \"master new\" &&\n+\t\ttest \"$(cat file3)\" = \"master new sub\" &&\n+\t\t( cd .. && git submodule update -N ) &&\n+\t\ttest \"$(cat ../submod/bar)\" = \"master submodule\" &&\n+\t\tgit commit -m \"branch2 resolved by mergetool from subdir\"\n+\t)\n+'\n+\n test_expect_success 'mergetool skips resolved paths when rerere is active' '\n \ttest_when_finished \"git reset --hard\" &&\n \ttest_config rerere.enabled true &&\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"308835","messageId":"20170106010945.79382-2-hansenr@google.com","threadId":"44811","inReplyTo":"20170106010945.79382-1-hansenr@google.com","subject":"[PATCH v2 1/4] t7610: update branch names to match test number","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-06T01:09:42Z","receivedAt":"2017-01-06T01:11:09Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"Rename the testNN branches so that NN matches the test number.  This\nshould make it easier to troubleshoot test issues.  Use $test_count to\nkeep this future-proof.\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n t/t7610-mergetool.sh | 82 ++++++++++++++++++++++++++--------------------------\n 1 file changed, 41 insertions(+), 41 deletions(-)\n\ndiff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh\nindex 6d9f21511..14090739f 100755\n--- a/t/t7610-mergetool.sh\n+++ b/t/t7610-mergetool.sh\n@@ -94,7 +94,7 @@ test_expect_success 'setup' '\n '\n \n test_expect_success 'custom mergetool' '\n-\tgit checkout -b test1 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \ttest_must_fail git merge master >/dev/null 2>&1 &&\n \t( yes \"\" | git mergetool both >/dev/null 2>&1 ) &&\n@@ -113,7 +113,7 @@ test_expect_success 'custom mergetool' '\n \n test_expect_success 'mergetool crlf' '\n \ttest_config core.autocrlf true &&\n-\tgit checkout -b test2 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \ttest_must_fail git merge master >/dev/null 2>&1 &&\n \t( yes \"\" | git mergetool file1 >/dev/null 2>&1 ) &&\n \t( yes \"\" | git mergetool file2 >/dev/null 2>&1 ) &&\n@@ -134,7 +134,7 @@ test_expect_success 'mergetool crlf' '\n '\n \n test_expect_success 'mergetool in subdir' '\n-\tgit checkout -b test3 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \t(\n \t\tcd subdir &&\n@@ -161,7 +161,7 @@ test_expect_success 'mergetool on file in parent dir' '\n '\n \n test_expect_success 'mergetool skips autoresolved' '\n-\tgit checkout -b test4 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \ttest_must_fail git merge master &&\n \ttest -n \"$(git ls-files -u)\" &&\n@@ -192,7 +192,7 @@ test_expect_success 'mergetool merges all from subdir' '\n test_expect_success 'mergetool skips resolved paths when rerere is active' '\n \ttest_config rerere.enabled true &&\n \trm -rf .git/rr-cache &&\n-\tgit checkout -b test5 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \ttest_must_fail git merge master >/dev/null 2>&1 &&\n \t( yes \"l\" | git mergetool --no-prompt submod >/dev/null 2>&1 ) &&\n@@ -233,7 +233,7 @@ test_expect_success 'conflicted stash sets up rerere'  '\n test_expect_success 'mergetool takes partial path' '\n \tgit reset --hard &&\n \ttest_config rerere.enabled false &&\n-\tgit checkout -b test12 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \ttest_must_fail git merge master &&\n \n@@ -308,12 +308,12 @@ test_expect_success 'mergetool keeps tempfiles when aborting delete/delete' '\n '\n \n test_expect_success 'deleted vs modified submodule' '\n-\tgit checkout -b test6 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \tmv submod submod-movedaside &&\n \tgit rm --cached submod &&\n \tgit commit -m \"Submodule deleted from branch\" &&\n-\tgit checkout -b test6.a test6 &&\n+\tgit checkout -b test$test_count.a test$test_count &&\n \ttest_must_fail git merge master &&\n \ttest -n \"$(git ls-files -u)\" &&\n \t( yes \"\" | git mergetool file1 file2 spaced\\ name subdir/file3 >/dev/null 2>&1 ) &&\n@@ -329,7 +329,7 @@ test_expect_success 'deleted vs modified submodule' '\n \tgit commit -m \"Merge resolved by keeping module\" &&\n \n \tmv submod submod-movedaside &&\n-\tgit checkout -b test6.b test6 &&\n+\tgit checkout -b test$test_count.b test$test_count &&\n \tgit submodule update -N &&\n \ttest_must_fail git merge master &&\n \ttest -n \"$(git ls-files -u)\" &&\n@@ -343,9 +343,9 @@ test_expect_success 'deleted vs modified submodule' '\n \tgit commit -m \"Merge resolved by deleting module\" &&\n \n \tmv submod-movedaside submod &&\n-\tgit checkout -b test6.c master &&\n+\tgit checkout -b test$test_count.c master &&\n \tgit submodule update -N &&\n-\ttest_must_fail git merge test6 &&\n+\ttest_must_fail git merge test$test_count &&\n \ttest -n \"$(git ls-files -u)\" &&\n \t( yes \"\" | git mergetool file1 file2 spaced\\ name subdir/file3 >/dev/null 2>&1 ) &&\n \t( yes \"\" | git mergetool both >/dev/null 2>&1 ) &&\n@@ -359,9 +359,9 @@ test_expect_success 'deleted vs modified submodule' '\n \tgit commit -m \"Merge resolved by deleting module\" &&\n \tmv submod.orig submod &&\n \n-\tgit checkout -b test6.d master &&\n+\tgit checkout -b test$test_count.d master &&\n \tgit submodule update -N &&\n-\ttest_must_fail git merge test6 &&\n+\ttest_must_fail git merge test$test_count &&\n \ttest -n \"$(git ls-files -u)\" &&\n \t( yes \"\" | git mergetool file1 file2 spaced\\ name subdir/file3 >/dev/null 2>&1 ) &&\n \t( yes \"\" | git mergetool both >/dev/null 2>&1 ) &&\n@@ -377,14 +377,14 @@ test_expect_success 'deleted vs modified submodule' '\n '\n \n test_expect_success 'file vs modified submodule' '\n-\tgit checkout -b test7 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \tmv submod submod-movedaside &&\n \tgit rm --cached submod &&\n \techo not a submodule >submod &&\n \tgit add submod &&\n \tgit commit -m \"Submodule path becomes file\" &&\n-\tgit checkout -b test7.a branch1 &&\n+\tgit checkout -b test$test_count.a branch1 &&\n \ttest_must_fail git merge master &&\n \ttest -n \"$(git ls-files -u)\" &&\n \t( yes \"\" | git mergetool file1 file2 spaced\\ name subdir/file3 >/dev/null 2>&1 ) &&\n@@ -400,7 +400,7 @@ test_expect_success 'file vs modified submodule' '\n \tgit commit -m \"Merge resolved by keeping module\" &&\n \n \tmv submod submod-movedaside &&\n-\tgit checkout -b test7.b test7 &&\n+\tgit checkout -b test$test_count.b test$test_count &&\n \ttest_must_fail git merge master &&\n \ttest -n \"$(git ls-files -u)\" &&\n \t( yes \"\" | git mergetool file1 file2 spaced\\ name subdir/file3 >/dev/null 2>&1 ) &&\n@@ -413,11 +413,11 @@ test_expect_success 'file vs modified submodule' '\n \ttest \"$output\" = \"No files need merging\" &&\n \tgit commit -m \"Merge resolved by keeping file\" &&\n \n-\tgit checkout -b test7.c master &&\n+\tgit checkout -b test$test_count.c master &&\n \trmdir submod && mv submod-movedaside submod &&\n \ttest ! -e submod.orig &&\n \tgit submodule update -N &&\n-\ttest_must_fail git merge test7 &&\n+\ttest_must_fail git merge test$test_count &&\n \ttest -n \"$(git ls-files -u)\" &&\n \t( yes \"\" | git mergetool file1 file2 spaced\\ name subdir/file3 >/dev/null 2>&1 ) &&\n \t( yes \"\" | git mergetool both >/dev/null 2>&1 ) &&\n@@ -430,10 +430,10 @@ test_expect_success 'file vs modified submodule' '\n \ttest \"$output\" = \"No files need merging\" &&\n \tgit commit -m \"Merge resolved by keeping file\" &&\n \n-\tgit checkout -b test7.d master &&\n+\tgit checkout -b test$test_count.d master &&\n \trmdir submod && mv submod.orig submod &&\n \tgit submodule update -N &&\n-\ttest_must_fail git merge test7 &&\n+\ttest_must_fail git merge test$test_count &&\n \ttest -n \"$(git ls-files -u)\" &&\n \t( yes \"\" | git mergetool file1 file2 spaced\\ name subdir/file3 >/dev/null 2>&1 ) &&\n \t( yes \"\" | git mergetool both>/dev/null 2>&1 ) &&\n@@ -448,7 +448,7 @@ test_expect_success 'file vs modified submodule' '\n '\n \n test_expect_success 'submodule in subdirectory' '\n-\tgit checkout -b test10 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \t(\n \t\tcd subdir &&\n@@ -464,52 +464,52 @@ test_expect_success 'submodule in subdirectory' '\n \tgit add subdir/subdir_module &&\n \tgit commit -m \"add submodule in subdirectory\" &&\n \n-\tgit checkout -b test10.a test10 &&\n+\tgit checkout -b test$test_count.a test$test_count &&\n \tgit submodule update -N &&\n \t(\n \tcd subdir/subdir_module &&\n \t\tgit checkout -b super10.a &&\n-\t\techo test10.a >file15 &&\n+\t\techo test$test_count.a >file15 &&\n \t\tgit add file15 &&\n \t\tgit commit -m \"on branch 10.a\"\n \t) &&\n \tgit add subdir/subdir_module &&\n-\tgit commit -m \"change submodule in subdirectory on test10.a\" &&\n+\tgit commit -m \"change submodule in subdirectory on test$test_count.a\" &&\n \n-\tgit checkout -b test10.b test10 &&\n+\tgit checkout -b test$test_count.b test$test_count &&\n \tgit submodule update -N &&\n \t(\n \t\tcd subdir/subdir_module &&\n \t\tgit checkout -b super10.b &&\n-\t\techo test10.b >file15 &&\n+\t\techo test$test_count.b >file15 &&\n \t\tgit add file15 &&\n \t\tgit commit -m \"on branch 10.b\"\n \t) &&\n \tgit add subdir/subdir_module &&\n-\tgit commit -m \"change submodule in subdirectory on test10.b\" &&\n+\tgit commit -m \"change submodule in subdirectory on test$test_count.b\" &&\n \n-\ttest_must_fail git merge test10.a >/dev/null 2>&1 &&\n+\ttest_must_fail git merge test$test_count.a >/dev/null 2>&1 &&\n \t(\n \t\tcd subdir &&\n \t\t( yes \"l\" | git mergetool subdir_module )\n \t) &&\n-\ttest \"$(cat subdir/subdir_module/file15)\" = \"test10.b\" &&\n+\ttest \"$(cat subdir/subdir_module/file15)\" = \"test$test_count.b\" &&\n \tgit submodule update -N &&\n-\ttest \"$(cat subdir/subdir_module/file15)\" = \"test10.b\" &&\n+\ttest \"$(cat subdir/subdir_module/file15)\" = \"test$test_count.b\" &&\n \tgit reset --hard &&\n \tgit submodule update -N &&\n \n-\ttest_must_fail git merge test10.a >/dev/null 2>&1 &&\n+\ttest_must_fail git merge test$test_count.a >/dev/null 2>&1 &&\n \t( yes \"r\" | git mergetool subdir/subdir_module ) &&\n-\ttest \"$(cat subdir/subdir_module/file15)\" = \"test10.b\" &&\n+\ttest \"$(cat subdir/subdir_module/file15)\" = \"test$test_count.b\" &&\n \tgit submodule update -N &&\n-\ttest \"$(cat subdir/subdir_module/file15)\" = \"test10.a\" &&\n+\ttest \"$(cat subdir/subdir_module/file15)\" = \"test$test_count.a\" &&\n \tgit commit -m \"branch1 resolved with mergetool\" &&\n \trm -rf subdir/subdir_module\n '\n \n test_expect_success 'directory vs modified submodule' '\n-\tgit checkout -b test11 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \tmv submod submod-movedaside &&\n \tgit rm --cached submod &&\n \tmkdir submod &&\n@@ -537,9 +537,9 @@ test_expect_success 'directory vs modified submodule' '\n \ttest \"$(cat submod/bar)\" = \"master submodule\" &&\n \tgit reset --hard >/dev/null 2>&1 && rm -rf submod-movedaside &&\n \n-\tgit checkout -b test11.c master &&\n+\tgit checkout -b test$test_count.c master &&\n \tgit submodule update -N &&\n-\ttest_must_fail git merge test11 &&\n+\ttest_must_fail git merge test$test_count &&\n \ttest -n \"$(git ls-files -u)\" &&\n \t( yes \"l\" | git mergetool submod ) &&\n \tgit submodule update -N &&\n@@ -547,7 +547,7 @@ test_expect_success 'directory vs modified submodule' '\n \n \tgit reset --hard >/dev/null 2>&1 &&\n \tgit submodule update -N &&\n-\ttest_must_fail git merge test11 &&\n+\ttest_must_fail git merge test$test_count &&\n \ttest -n \"$(git ls-files -u)\" &&\n \ttest ! -e submod.orig &&\n \t( yes \"r\" | git mergetool submod ) &&\n@@ -559,7 +559,7 @@ test_expect_success 'directory vs modified submodule' '\n '\n \n test_expect_success 'file with no base' '\n-\tgit checkout -b test13 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \ttest_must_fail git merge master &&\n \tgit mergetool --no-prompt --tool mybase -- both &&\n \t>expected &&\n@@ -568,7 +568,7 @@ test_expect_success 'file with no base' '\n '\n \n test_expect_success 'custom commands override built-ins' '\n-\tgit checkout -b test14 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \ttest_config mergetool.defaults.cmd \"cat \\\"\\$REMOTE\\\" >\\\"\\$MERGED\\\"\" &&\n \ttest_config mergetool.defaults.trustExitCode true &&\n \ttest_must_fail git merge master &&\n@@ -579,7 +579,7 @@ test_expect_success 'custom commands override built-ins' '\n '\n \n test_expect_success 'filenames seen by tools start with ./' '\n-\tgit checkout -b test15 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \ttest_config mergetool.writeToTemp false &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n \ttest_config mergetool.myecho.trustExitCode true &&\n@@ -595,7 +595,7 @@ test_lazy_prereq MKTEMP '\n '\n \n test_expect_success MKTEMP 'temporary filenames are used with mergetool.writeToTemp' '\n-\tgit checkout -b test16 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \ttest_config mergetool.writeToTemp true &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n \ttest_config mergetool.myecho.trustExitCode true &&\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"308836","messageId":"20170106010945.79382-3-hansenr@google.com","threadId":"44811","inReplyTo":"20170106010945.79382-1-hansenr@google.com","subject":"[PATCH v2 2/4] t7610: make tests more independent and debuggable","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-06T01:09:43Z","receivedAt":"2017-01-06T01:11:11Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"Reduce how much a test can interfere other tests:\n\n  * Move setup code that multiple tests depend on to the 'setup' test\n    case.\n  * Run 'git reset --hard' after every test (pass or fail) to clean up\n    in case the test fails and leaves the repository in a strange\n    state.\n  * If the repository must be in a particular state (beyond what is\n    already done by the 'setup' test case) before the test can run,\n    make the necessary repository changes in the test script even if\n    it means duplicating some lines of code from the previous test\n    case.\n  * Never assume that a particular commit is checked out.\n  * Always work on a test-specific branch when the test might create a\n    commit.  This is not always necessary for correctness, but it\n    improves debuggability by ensuring a commit created by test #N\n    shows up on the testN branch, not the branch for test #N-1.\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n t/t7610-mergetool.sh | 146 +++++++++++++++++++++++++++++----------------------\n 1 file changed, 84 insertions(+), 62 deletions(-)\n\ndiff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh\nindex 14090739f..2c06cf73f 100755\n--- a/t/t7610-mergetool.sh\n+++ b/t/t7610-mergetool.sh\n@@ -55,6 +55,22 @@ test_expect_success 'setup' '\n \tgit rm file12 &&\n \tgit commit -m \"branch1 changes\" &&\n \n+\tgit checkout -b delete-base branch1 &&\n+\tmkdir -p a/a &&\n+\t(echo one; echo two; echo 3; echo 4) >a/a/file.txt &&\n+\tgit add a/a/file.txt &&\n+\tgit commit -m\"base file\" &&\n+\tgit checkout -b move-to-b delete-base &&\n+\tmkdir -p b/b &&\n+\tgit mv a/a/file.txt b/b/file.txt &&\n+\t(echo one; echo two; echo 4) >b/b/file.txt &&\n+\tgit commit -a -m\"move to b\" &&\n+\tgit checkout -b move-to-c delete-base &&\n+\tmkdir -p c/c &&\n+\tgit mv a/a/file.txt c/c/file.txt &&\n+\t(echo one; echo two; echo 3) >c/c/file.txt &&\n+\tgit commit -a -m\"move to c\" &&\n+\n \tgit checkout -b stash1 master &&\n \techo stash1 change file11 >file11 &&\n \tgit add file11 &&\n@@ -86,6 +102,23 @@ test_expect_success 'setup' '\n \tgit rm file11 &&\n \tgit commit -m \"master updates\" &&\n \n+\tgit clean -fdx &&\n+\tgit checkout -b order-file-start master &&\n+\techo start >a &&\n+\techo start >b &&\n+\tgit add a b &&\n+\tgit commit -m start &&\n+\tgit checkout -b order-file-side1 order-file-start &&\n+\techo side1 >a &&\n+\techo side1 >b &&\n+\tgit add a b &&\n+\tgit commit -m side1 &&\n+\tgit checkout -b order-file-side2 order-file-start &&\n+\techo side2 >a &&\n+\techo side2 >b &&\n+\tgit add a b &&\n+\tgit commit -m side2 &&\n+\n \tgit config merge.tool mytool &&\n \tgit config mergetool.mytool.cmd \"cat \\\"\\$REMOTE\\\" >\\\"\\$MERGED\\\"\" &&\n \tgit config mergetool.mytool.trustExitCode true &&\n@@ -94,6 +127,7 @@ test_expect_success 'setup' '\n '\n \n test_expect_success 'custom mergetool' '\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \ttest_must_fail git merge master >/dev/null 2>&1 &&\n@@ -112,6 +146,7 @@ test_expect_success 'custom mergetool' '\n '\n \n test_expect_success 'mergetool crlf' '\n+\ttest_when_finished \"git reset --hard\" &&\n \ttest_config core.autocrlf true &&\n \tgit checkout -b test$test_count branch1 &&\n \ttest_must_fail git merge master >/dev/null 2>&1 &&\n@@ -129,11 +164,11 @@ test_expect_success 'mergetool crlf' '\n \tgit submodule update -N &&\n \ttest \"$(cat submod/bar)\" = \"master submodule\" &&\n \tgit commit -m \"branch1 resolved with mergetool - autocrlf\" &&\n-\ttest_config core.autocrlf false &&\n-\tgit reset --hard\n+\ttest_config core.autocrlf false\n '\n \n test_expect_success 'mergetool in subdir' '\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \t(\n@@ -145,8 +180,13 @@ test_expect_success 'mergetool in subdir' '\n '\n \n test_expect_success 'mergetool on file in parent dir' '\n+\ttest_when_finished \"git reset --hard\" &&\n+\tgit checkout -b test$test_count branch1 &&\n+\tgit submodule update -N &&\n \t(\n \t\tcd subdir &&\n+\t\ttest_must_fail git merge master >/dev/null 2>&1 &&\n+\t\t( yes \"\" | git mergetool file3 >/dev/null 2>&1 ) &&\n \t\t( yes \"\" | git mergetool ../file1 >/dev/null 2>&1 ) &&\n \t\t( yes \"\" | git mergetool ../file2 ../spaced\\ name >/dev/null 2>&1 ) &&\n \t\t( yes \"\" | git mergetool ../both >/dev/null 2>&1 ) &&\n@@ -161,6 +201,7 @@ test_expect_success 'mergetool on file in parent dir' '\n '\n \n test_expect_success 'mergetool skips autoresolved' '\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \ttest_must_fail git merge master &&\n@@ -169,11 +210,12 @@ test_expect_success 'mergetool skips autoresolved' '\n \t( yes \"d\" | git mergetool file12 >/dev/null 2>&1 ) &&\n \t( yes \"l\" | git mergetool submod >/dev/null 2>&1 ) &&\n \toutput=\"$(git mergetool --no-prompt)\" &&\n-\ttest \"$output\" = \"No files need merging\" &&\n-\tgit reset --hard\n+\ttest \"$output\" = \"No files need merging\"\n '\n \n test_expect_success 'mergetool merges all from subdir' '\n+\ttest_when_finished \"git reset --hard\" &&\n+\tgit checkout -b test$test_count branch1 &&\n \ttest_config rerere.enabled false &&\n \t(\n \t\tcd subdir &&\n@@ -190,6 +232,7 @@ test_expect_success 'mergetool merges all from subdir' '\n '\n \n test_expect_success 'mergetool skips resolved paths when rerere is active' '\n+\ttest_when_finished \"git reset --hard\" &&\n \ttest_config rerere.enabled true &&\n \trm -rf .git/rr-cache &&\n \tgit checkout -b test$test_count branch1 &&\n@@ -199,11 +242,11 @@ test_expect_success 'mergetool skips resolved paths when rerere is active' '\n \t( yes \"d\" \"d\" | git mergetool --no-prompt >/dev/null 2>&1 ) &&\n \tgit submodule update -N &&\n \toutput=\"$(yes \"n\" | git mergetool --no-prompt)\" &&\n-\ttest \"$output\" = \"No files need merging\" &&\n-\tgit reset --hard\n+\ttest \"$output\" = \"No files need merging\"\n '\n \n test_expect_success 'conflicted stash sets up rerere'  '\n+\ttest_when_finished \"git reset --hard\" &&\n \ttest_config rerere.enabled true &&\n \tgit checkout stash1 &&\n \techo \"Conflicting stash content\" >file11 &&\n@@ -231,7 +274,7 @@ test_expect_success 'conflicted stash sets up rerere'  '\n '\n \n test_expect_success 'mergetool takes partial path' '\n-\tgit reset --hard &&\n+\ttest_when_finished \"git reset --hard\" &&\n \ttest_config rerere.enabled false &&\n \tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n@@ -239,26 +282,12 @@ test_expect_success 'mergetool takes partial path' '\n \n \t( yes \"\" | git mergetool subdir ) &&\n \n-\ttest \"$(cat subdir/file3)\" = \"master new sub\" &&\n-\tgit reset --hard\n+\ttest \"$(cat subdir/file3)\" = \"master new sub\"\n '\n \n test_expect_success 'mergetool delete/delete conflict' '\n-\tgit checkout -b delete-base branch1 &&\n-\tmkdir -p a/a &&\n-\t(echo one; echo two; echo 3; echo 4) >a/a/file.txt &&\n-\tgit add a/a/file.txt &&\n-\tgit commit -m\"base file\" &&\n-\tgit checkout -b move-to-b delete-base &&\n-\tmkdir -p b/b &&\n-\tgit mv a/a/file.txt b/b/file.txt &&\n-\t(echo one; echo two; echo 4) >b/b/file.txt &&\n-\tgit commit -a -m\"move to b\" &&\n-\tgit checkout -b move-to-c delete-base &&\n-\tmkdir -p c/c &&\n-\tgit mv a/a/file.txt c/c/file.txt &&\n-\t(echo one; echo two; echo 3) >c/c/file.txt &&\n-\tgit commit -a -m\"move to c\" &&\n+\ttest_when_finished \"git reset --hard\" &&\n+\tgit checkout -b test$test_count move-to-c &&\n \ttest_must_fail git merge move-to-b &&\n \techo d | git mergetool a/a/file.txt &&\n \t! test -f a/a/file.txt &&\n@@ -269,29 +298,32 @@ test_expect_success 'mergetool delete/delete conflict' '\n \tgit reset --hard HEAD &&\n \ttest_must_fail git merge move-to-b &&\n \t! echo a | git mergetool a/a/file.txt &&\n-\t! test -f a/a/file.txt &&\n-\tgit reset --hard HEAD\n+\t! test -f a/a/file.txt\n '\n \n test_expect_success 'mergetool produces no errors when keepBackup is used' '\n+\ttest_when_finished \"git reset --hard\" &&\n+\tgit checkout -b test$test_count move-to-c &&\n \ttest_config mergetool.keepBackup true &&\n \ttest_must_fail git merge move-to-b &&\n \t: >expect &&\n \techo d | git mergetool a/a/file.txt 2>actual &&\n \ttest_cmp expect actual &&\n-\t! test -d a &&\n-\tgit reset --hard HEAD\n+\t! test -d a\n '\n \n test_expect_success 'mergetool honors tempfile config for deleted files' '\n+\ttest_when_finished \"git reset --hard\" &&\n+\tgit checkout -b test$test_count move-to-c &&\n \ttest_config mergetool.keepTemporaries false &&\n \ttest_must_fail git merge move-to-b &&\n \techo d | git mergetool a/a/file.txt &&\n-\t! test -d a &&\n-\tgit reset --hard HEAD\n+\t! test -d a\n '\n \n test_expect_success 'mergetool keeps tempfiles when aborting delete/delete' '\n+\ttest_when_finished \"git reset --hard; git clean -fdx\" &&\n+\tgit checkout -b test$test_count move-to-c &&\n \ttest_config mergetool.keepTemporaries true &&\n \ttest_must_fail git merge move-to-b &&\n \t! (echo a; echo n) | git mergetool a/a/file.txt &&\n@@ -302,12 +334,11 @@ test_expect_success 'mergetool keeps tempfiles when aborting delete/delete' '\n \tfile_REMOTE_.txt\n \tEOF\n \tls -1 a/a | sed -e \"s/[0-9]*//g\" >actual &&\n-\ttest_cmp expect actual &&\n-\tgit clean -fdx &&\n-\tgit reset --hard HEAD\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'deleted vs modified submodule' '\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \tmv submod submod-movedaside &&\n@@ -372,11 +403,11 @@ test_expect_success 'deleted vs modified submodule' '\n \ttest \"$(cat submod/bar)\" = \"master submodule\" &&\n \toutput=\"$(git mergetool --no-prompt)\" &&\n \ttest \"$output\" = \"No files need merging\" &&\n-\tgit commit -m \"Merge resolved by keeping module\" &&\n-\tgit reset --hard HEAD\n+\tgit commit -m \"Merge resolved by keeping module\"\n '\n \n test_expect_success 'file vs modified submodule' '\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \tmv submod submod-movedaside &&\n@@ -448,6 +479,7 @@ test_expect_success 'file vs modified submodule' '\n '\n \n test_expect_success 'submodule in subdirectory' '\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \t(\n@@ -509,6 +541,7 @@ test_expect_success 'submodule in subdirectory' '\n '\n \n test_expect_success 'directory vs modified submodule' '\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \tmv submod submod-movedaside &&\n \tgit rm --cached submod &&\n@@ -559,34 +592,34 @@ test_expect_success 'directory vs modified submodule' '\n '\n \n test_expect_success 'file with no base' '\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \ttest_must_fail git merge master &&\n \tgit mergetool --no-prompt --tool mybase -- both &&\n \t>expected &&\n-\ttest_cmp both expected &&\n-\tgit reset --hard master >/dev/null 2>&1\n+\ttest_cmp both expected\n '\n \n test_expect_success 'custom commands override built-ins' '\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \ttest_config mergetool.defaults.cmd \"cat \\\"\\$REMOTE\\\" >\\\"\\$MERGED\\\"\" &&\n \ttest_config mergetool.defaults.trustExitCode true &&\n \ttest_must_fail git merge master &&\n \tgit mergetool --no-prompt --tool defaults -- both &&\n \techo master both added >expected &&\n-\ttest_cmp both expected &&\n-\tgit reset --hard master >/dev/null 2>&1\n+\ttest_cmp both expected\n '\n \n test_expect_success 'filenames seen by tools start with ./' '\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \ttest_config mergetool.writeToTemp false &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n \ttest_config mergetool.myecho.trustExitCode true &&\n \ttest_must_fail git merge master &&\n \tgit mergetool --no-prompt --tool myecho -- both >actual &&\n-\tgrep ^\\./both_LOCAL_ actual >/dev/null &&\n-\tgit reset --hard master >/dev/null 2>&1\n+\tgrep ^\\./both_LOCAL_ actual >/dev/null\n '\n \n test_lazy_prereq MKTEMP '\n@@ -595,6 +628,7 @@ test_lazy_prereq MKTEMP '\n '\n \n test_expect_success MKTEMP 'temporary filenames are used with mergetool.writeToTemp' '\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \ttest_config mergetool.writeToTemp true &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n@@ -602,31 +636,17 @@ test_expect_success MKTEMP 'temporary filenames are used with mergetool.writeToT\n \ttest_must_fail git merge master &&\n \tgit mergetool --no-prompt --tool myecho -- both >actual &&\n \ttest_must_fail grep ^\\./both_LOCAL_ actual >/dev/null &&\n-\tgrep /both_LOCAL_ actual >/dev/null &&\n-\tgit reset --hard master >/dev/null 2>&1\n+\tgrep /both_LOCAL_ actual >/dev/null\n '\n \n test_expect_success 'diff.orderFile configuration is honored' '\n+\ttest_when_finished \"git reset --hard\" &&\n+\tgit checkout -b test$test_count order-file-side2 &&\n \ttest_config diff.orderFile order-file &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n \ttest_config mergetool.myecho.trustExitCode true &&\n \techo b >order-file &&\n \techo a >>order-file &&\n-\tgit checkout -b order-file-start master &&\n-\techo start >a &&\n-\techo start >b &&\n-\tgit add a b &&\n-\tgit commit -m start &&\n-\tgit checkout -b order-file-side1 order-file-start &&\n-\techo side1 >a &&\n-\techo side1 >b &&\n-\tgit add a b &&\n-\tgit commit -m side1 &&\n-\tgit checkout -b order-file-side2 order-file-start &&\n-\techo side2 >a &&\n-\techo side2 >b &&\n-\tgit add a b &&\n-\tgit commit -m side2 &&\n \ttest_must_fail git merge order-file-side1 &&\n \tcat >expect <<-\\EOF &&\n \t\tMerging:\n@@ -635,13 +655,16 @@ test_expect_success 'diff.orderFile configuration is honored' '\n \tEOF\n \tgit mergetool --no-prompt --tool myecho >output &&\n \tgit grep --no-index -h -A2 Merging: output >actual &&\n-\ttest_cmp expect actual &&\n-\tgit reset --hard >/dev/null\n+\ttest_cmp expect actual\n '\n test_expect_success 'mergetool -Oorder-file is honored' '\n+\ttest_when_finished \"git reset --hard\" &&\n+\tgit checkout -b test$test_count order-file-side2 &&\n \ttest_config diff.orderFile order-file &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n \ttest_config mergetool.myecho.trustExitCode true &&\n+\techo b >order-file &&\n+\techo a >>order-file &&\n \ttest_must_fail git merge order-file-side1 &&\n \tcat >expect <<-\\EOF &&\n \t\tMerging:\n@@ -662,8 +685,7 @@ test_expect_success 'mergetool -Oorder-file is honored' '\n \tEOF\n \tgit mergetool -Oorder-file --no-prompt --tool myecho >output &&\n \tgit grep --no-index -h -A2 Merging: output >actual &&\n-\ttest_cmp expect actual &&\n-\tgit reset --hard >/dev/null 2>&1\n+\ttest_cmp expect actual\n '\n \n test_done\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"308837","messageId":"CAGZ79kbRee+3MbAHCSFB0QqGMMF5bcZMiEHV-coRh87vFfq0Ag@mail.gmail.com","threadId":"44811","inReplyTo":"20170106010945.79382-3-hansenr@google.com","subject":"Re: [PATCH v2 2/4] t7610: make tests more independent and debuggable","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2017-01-06T01:31:49Z","receivedAt":"2017-01-06T01:32:55Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Thu, Jan 5, 2017 at 5:09 PM, Richard Hansen <hansenr@google.com> wrote:\n> Reduce how much a test can interfere other tests:\n\nA bullet point list as an unordered list often indicates that you're\ndoing multiple\nthings at once, possibly unrelated, so they could go into different patches. ;)\n\nWhile telling you to make even more commits: you may also want to make\na patch with an entry to the .mailmap file (assuming you're the same\nRichard Hansen that contributed from rhansen@bbn.com);\nWelcome to Google!\n\n>\n>   * Move setup code that multiple tests depend on to the 'setup' test\n>     case.\n>   * Run 'git reset --hard' after every test (pass or fail) to clean up\n>     in case the test fails and leaves the repository in a strange\n>     state.\n>   * If the repository must be in a particular state (beyond what is\n>     already done by the 'setup' test case) before the test can run,\n>     make the necessary repository changes in the test script even if\n>     it means duplicating some lines of code from the previous test\n>     case.\n>   * Never assume that a particular commit is checked out.\n>   * Always work on a test-specific branch when the test might create a\n>     commit.  This is not always necessary for correctness, but it\n>     improves debuggability by ensuring a commit created by test #N\n>     shows up on the testN branch, not the branch for test #N-1.\n\n\n\n\n> @@ -112,6 +146,7 @@ test_expect_success 'custom mergetool' '\n>  '\n>\n>  test_expect_success 'mergetool crlf' '\n> +       test_when_finished \"git reset --hard\" &&\n>         test_config core.autocrlf true &&\n>         git checkout -b test$test_count branch1 &&\n>         test_must_fail git merge master >/dev/null 2>&1 &&\n> @@ -129,11 +164,11 @@ test_expect_success 'mergetool crlf' '\n>         git submodule update -N &&\n>         test \"$(cat submod/bar)\" = \"master submodule\" &&\n>         git commit -m \"branch1 resolved with mergetool - autocrlf\" &&\n\n> -       test_config core.autocrlf false &&\n> -       git reset --hard\n> +       test_config core.autocrlf false\n>  '\n\nThis is the nit that led me to writing this email in the first place:\ntest_config is a function that sets a configuration for a single test only,\nso it makes no sense as the last statement of a test. (In its implementation\nit un-configures with test_when_finished)\n\nSo I think we do not want to add it back, but rather remove this\ntest_config statement.\n\nBut to do this we need to actually be careful with the order of the newly\nadded test_when_finished \"git reset --hard\" and  test_config core.autocrlf true,\nwhich uses test_when_finished internally.\n\nThe order seems correct to me, as the reset would be executed after the\n\"test_config core.autocrlf true\" is un-configured.\n"},{"id":"308850","messageId":"199807ae-844c-57cd-28cf-2c10b3aee7a9@kdbg.org","threadId":"44811","inReplyTo":"20170106010945.79382-5-hansenr@google.com","subject":"Re: [PATCH v2 4/4] mergetool: fix running in subdir when rerere enabled","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2017-01-06T09:42:40Z","receivedAt":"2017-01-06T09:46:16Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 06.01.2017 um 02:09 schrieb Richard Hansen:\n> If rerere is enabled and no pathnames are given, run cd_to_toplevel\n> before running 'git diff --name-only' so that 'git diff --name-only'\n> sees the pathnames emitted by 'git rerere remaining'.\n>\n> Also run cd_to_toplevel before running 'git rerere remaining' in case\n> 'git rerere remaining' is ever changed to print pathnames relative to\n> the current directory rather than to $GIT_WORK_TREE.\n>\n> This fixes a regression introduced in\n> 57937f70a09c12ef484c290865dac4066d207c9c (v2.11.0).\n>\n> Signed-off-by: Richard Hansen <hansenr@google.com>\n> ---\n>  git-mergetool.sh     | 1 +\n>  t/t7610-mergetool.sh | 2 +-\n>  2 files changed, 2 insertions(+), 1 deletion(-)\n>\n> diff --git a/git-mergetool.sh b/git-mergetool.sh\n> index e52b4e4f2..67ea0d6db 100755\n> --- a/git-mergetool.sh\n> +++ b/git-mergetool.sh\n> @@ -456,6 +456,7 @@ main () {\n>\n>  \tif test $# -eq 0 && test -e \"$GIT_DIR/MERGE_RR\"\n>  \tthen\n> +\t\tcd_to_toplevel\n>  \t\tset -- $(git rerere remaining)\n>  \t\tif test $# -eq 0\n>  \t\tthen\n\nThis cannot be a complete solution. Why do we have another \ncd_to_toplevel later, after `git diff --name-only -- \"$@\"`?\n\nMaybe it is necessary to revert back to the flow control that we had \nbefore 57937f70a09c (\"mergetool: honor diff.orderFile\", 2016-10-07)? It \ndid not have `test $# -eq 0` and `test -e \"$GIT_DIR/MERGE_RR\"` in a \nsingle condition.\n\n-- Hannes\n\n"},{"id":"308916","messageId":"f5739254-c0c9-8791-03f3-1bf4f7eb2acf@google.com","threadId":"44811","inReplyTo":"CAGZ79kbRee+3MbAHCSFB0QqGMMF5bcZMiEHV-coRh87vFfq0Ag@mail.gmail.com","subject":"Re: [PATCH v2 2/4] t7610: make tests more independent and debuggable","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-07T01:53:29Z","receivedAt":"2017-01-07T01:53:36Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"On 2017-01-05 20:31, Stefan Beller wrote:\n> On Thu, Jan 5, 2017 at 5:09 PM, Richard Hansen <hansenr@google.com> wrote:\n>> Reduce how much a test can interfere other tests:\n>\n> A bullet point list as an unordered list often indicates that you're\n> doing multiple\n> things at once, possibly unrelated, so they could go into different patches. ;)\n\nOK, I'll split it up.\n\n>\n> While telling you to make even more commits: you may also want to make\n> a patch with an entry to the .mailmap file (assuming you're the same\n> Richard Hansen that contributed from rhansen@bbn.com);\n> Welcome to Google!\n\nGood idea, thanks!\n\n>\n>>\n>>   * Move setup code that multiple tests depend on to the 'setup' test\n>>     case.\n>>   * Run 'git reset --hard' after every test (pass or fail) to clean up\n>>     in case the test fails and leaves the repository in a strange\n>>     state.\n>>   * If the repository must be in a particular state (beyond what is\n>>     already done by the 'setup' test case) before the test can run,\n>>     make the necessary repository changes in the test script even if\n>>     it means duplicating some lines of code from the previous test\n>>     case.\n>>   * Never assume that a particular commit is checked out.\n>>   * Always work on a test-specific branch when the test might create a\n>>     commit.  This is not always necessary for correctness, but it\n>>     improves debuggability by ensuring a commit created by test #N\n>>     shows up on the testN branch, not the branch for test #N-1.\n>\n>\n>\n>\n>> @@ -112,6 +146,7 @@ test_expect_success 'custom mergetool' '\n>>  '\n>>\n>>  test_expect_success 'mergetool crlf' '\n>> +       test_when_finished \"git reset --hard\" &&\n>>         test_config core.autocrlf true &&\n>>         git checkout -b test$test_count branch1 &&\n>>         test_must_fail git merge master >/dev/null 2>&1 &&\n>> @@ -129,11 +164,11 @@ test_expect_success 'mergetool crlf' '\n>>         git submodule update -N &&\n>>         test \"$(cat submod/bar)\" = \"master submodule\" &&\n>>         git commit -m \"branch1 resolved with mergetool - autocrlf\" &&\n>\n>> -       test_config core.autocrlf false &&\n>> -       git reset --hard\n>> +       test_config core.autocrlf false\n>>  '\n>\n> This is the nit that led me to writing this email in the first place:\n> test_config is a function that sets a configuration for a single test only,\n> so it makes no sense as the last statement of a test. (In its implementation\n> it un-configures with test_when_finished)\n>\n> So I think we do not want to add it back, but rather remove this\n> test_config statement.\n\nOK, will do.\n\n>\n> But to do this we need to actually be careful with the order of the newly\n> added test_when_finished \"git reset --hard\" and  test_config core.autocrlf true,\n> which uses test_when_finished internally.\n\nAh, yes.  Tricky.  I'll add a comment.\n\n>\n> The order seems correct to me, as the reset would be executed after the\n> \"test_config core.autocrlf true\" is un-configured.\n\nAgreed; test_when_finished is LIFO (though the order is not documented).\n\n-Richard\n"},{"id":"308917","messageId":"7a561587-3afc-58f9-a490-6bcaa7287576@google.com","threadId":"44811","inReplyTo":"199807ae-844c-57cd-28cf-2c10b3aee7a9@kdbg.org","subject":"Re: [PATCH v2 4/4] mergetool: fix running in subdir when rerere enabled","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-07T02:16:00Z","receivedAt":"2017-01-07T02:18:05Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"On 2017-01-06 04:42, Johannes Sixt wrote:\n> Am 06.01.2017 um 02:09 schrieb Richard Hansen:\n>> If rerere is enabled and no pathnames are given, run cd_to_toplevel\n>> before running 'git diff --name-only' so that 'git diff --name-only'\n>> sees the pathnames emitted by 'git rerere remaining'.\n>>\n>> Also run cd_to_toplevel before running 'git rerere remaining' in case\n>> 'git rerere remaining' is ever changed to print pathnames relative to\n>> the current directory rather than to $GIT_WORK_TREE.\n>>\n>> This fixes a regression introduced in\n>> 57937f70a09c12ef484c290865dac4066d207c9c (v2.11.0).\n>>\n>> Signed-off-by: Richard Hansen <hansenr@google.com>\n>> ---\n>>  git-mergetool.sh     | 1 +\n>>  t/t7610-mergetool.sh | 2 +-\n>>  2 files changed, 2 insertions(+), 1 deletion(-)\n>>\n>> diff --git a/git-mergetool.sh b/git-mergetool.sh\n>> index e52b4e4f2..67ea0d6db 100755\n>> --- a/git-mergetool.sh\n>> +++ b/git-mergetool.sh\n>> @@ -456,6 +456,7 @@ main () {\n>>\n>>      if test $# -eq 0 && test -e \"$GIT_DIR/MERGE_RR\"\n>>      then\n>> +        cd_to_toplevel\n>>          set -- $(git rerere remaining)\n>>          if test $# -eq 0\n>>          then\n>\n> This cannot be a complete solution. Why do we have another\n> cd_to_toplevel later, after `git diff --name-only -- \"$@\"`?\n\nThe arguments passed to 'git diff' (including the -O argument) are all \ninterpreted as relative to the current working directory, yet 'git diff \n--name-only' outputs pathnames that are relative to the top-level \ndirectory.  Thus:\n\n   * cd_to_toplevel MUST NOT be run before that 'git diff' command\n     unless all pathnames relative to $PWD are converted to absolute (or\n     relative to the top-level directory), and\n   * cd_to_toplevel MUST be run after 'git diff' so that $files is\n     interpreted correctly.\n\nAnd now I realize that my change breaks -O<foo> if <foo> is relative to \n$PWD.  Grr.  Too bad we don't have tests for running mergetool \n-O<relative-path> from a subdirectory.\n\n>\n> Maybe it is necessary to revert back to the flow control that we had\n> before 57937f70a09c (\"mergetool: honor diff.orderFile\", 2016-10-07)? It\n> did not have `test $# -eq 0` and `test -e \"$GIT_DIR/MERGE_RR\"` in a\n> single condition.\n\nReverting to the previous control flow won't work unless the -O pathname \nis converted to absolute (or relative to the top-level directory).  But \nI'll have to do that anyway.  Blech.\n\nDo we already have a helper shell function somewhere that converts a \npathname to absolute?  Thanks to symlinks it's trickier than one might \nexpect.\n\nThanks,\nRichard\n\n\n>\n> -- Hannes\n"},{"id":"308985","messageId":"20170109054238.42599-1-hansenr@google.com","threadId":"44811","inReplyTo":"20170106010945.79382-1-hansenr@google.com","subject":"[PATCH v3 00/13] fix mergetool+rerere+subdir regression","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-09T05:42:25Z","receivedAt":"2017-01-09T05:43:02Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"If rerere is enabled, no pathnames are given, and mergetool is run\nfrom a subdirectory, mergetool always prints \"No files need merging\".\nFix the bug.\n\nThis regression was introduced in\n57937f70a09c12ef484c290865dac4066d207c9c (v2.11.0).\n\nChanges since v2:\n  * Added entries to .mailmap.\n  * Patch 2/4 was split into multiple separate commits.\n  * Moved '-O' out of $orderfile.\n  * $orderfile is now adjusted after running cd_to_toplevel.\n  * Added lots of comments.\n  * Other minor tweaks to address review feedback.\n\nRichard Hansen (13):\n  .mailmap: Use my personal email address as my canonical\n  t7610: update branch names to match test number\n  t7610: Move setup code to the 'setup' test case.\n  t7610: use test_when_finished for cleanup tasks\n  t7610: don't rely on state from previous test\n  t7610: run 'git reset --hard' after each test to clean up\n  t7610: delete some now-unnecessary 'git reset --hard' lines\n  t7610: always work on a test-specific branch\n  t7610: don't assume the checked-out commit\n  t7610: spell 'git reset --hard' consistently\n  t7610: add test case for rerere+mergetool+subdir bug\n  mergetool: take the \"-O\" out of $orderfile\n  mergetool: fix running in subdir when rerere enabled\n\n .mailmap             |   2 +\n git-mergetool.sh     |  36 ++++++-\n t/t7610-mergetool.sh | 276 ++++++++++++++++++++++++++++++---------------------\n 3 files changed, 197 insertions(+), 117 deletions(-)\n\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"308986","messageId":"20170109054238.42599-2-hansenr@google.com","threadId":"44811","inReplyTo":"20170109054238.42599-1-hansenr@google.com","subject":"[PATCH v3 01/13] .mailmap: Use my personal email address as my canonical","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-09T05:42:26Z","receivedAt":"2017-01-09T05:43:07Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"When I changed employers my work address changed from rhansen@bbn.com\nto hansenr@google.com.  Rather than map my old work address to my new,\nmap them both to my permanent personal email address.  (I will still\nuse my work address in commits I submit so that my employer gets some\ncredit.)\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n .mailmap | 2 ++\n 1 file changed, 2 insertions(+)\n\ndiff --git a/.mailmap b/.mailmap\nindex 9cc33e925..9c87a3840 100644\n--- a/.mailmap\n+++ b/.mailmap\n@@ -192,6 +192,8 @@ Philippe Bruhat <book@cpan.org>\n Ralf Thielow <ralf.thielow@gmail.com> <ralf.thielow@googlemail.com>\n Ramsay Jones <ramsay@ramsayjones.plus.com> <ramsay@ramsay1.demon.co.uk>\n René Scharfe <l.s.r@web.de> <rene.scharfe@lsrfire.ath.cx>\n+Richard Hansen <rhansen@rhansen.org> <hansenr@google.com>\n+Richard Hansen <rhansen@rhansen.org> <rhansen@bbn.com>\n Robert Fitzsimons <robfitz@273k.net>\n Robert Shearman <robertshearman@gmail.com> <rob@codeweavers.com>\n Robert Zeh <robert.a.zeh@gmail.com>\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"308987","messageId":"20170109054238.42599-6-hansenr@google.com","threadId":"44811","inReplyTo":"20170109054238.42599-1-hansenr@google.com","subject":"[PATCH v3 05/13] t7610: don't rely on state from previous test","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-09T05:42:30Z","receivedAt":"2017-01-09T05:43:10Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"If the repository must be in a particular state (beyond what is\nalready done by the 'setup' test case) before the test can run, make\nthe necessary repository changes in the test script even if it means\nduplicating some lines of code from the previous test case.\n\nThis is a step toward making the tests more independent so that if one\ntest fails it doesn't cause subsequent tests to fail.\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n t/t7610-mergetool.sh | 6 ++++++\n 1 file changed, 6 insertions(+)\n\ndiff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh\nindex f62ceffdc..2d92a2646 100755\n--- a/t/t7610-mergetool.sh\n+++ b/t/t7610-mergetool.sh\n@@ -181,8 +181,12 @@ test_expect_success 'mergetool in subdir' '\n '\n \n test_expect_success 'mergetool on file in parent dir' '\n+\tgit reset --hard &&\n+\tgit submodule update -N &&\n \t(\n \t\tcd subdir &&\n+\t\ttest_must_fail git merge master >/dev/null 2>&1 &&\n+\t\t( yes \"\" | git mergetool file3 >/dev/null 2>&1 ) &&\n \t\t( yes \"\" | git mergetool ../file1 >/dev/null 2>&1 ) &&\n \t\t( yes \"\" | git mergetool ../file2 ../spaced\\ name >/dev/null 2>&1 ) &&\n \t\t( yes \"\" | git mergetool ../both >/dev/null 2>&1 ) &&\n@@ -651,6 +655,8 @@ test_expect_success 'mergetool -Oorder-file is honored' '\n \ttest_config diff.orderFile order-file &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n \ttest_config mergetool.myecho.trustExitCode true &&\n+\techo b >order-file &&\n+\techo a >>order-file &&\n \ttest_must_fail git merge order-file-side1 &&\n \tcat >expect <<-\\EOF &&\n \t\tMerging:\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"308988","messageId":"20170109054238.42599-7-hansenr@google.com","threadId":"44811","inReplyTo":"20170109054238.42599-1-hansenr@google.com","subject":"[PATCH v3 06/13] t7610: run 'git reset --hard' after each test to clean up","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-09T05:42:31Z","receivedAt":"2017-01-09T05:43:18Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"Use test_when_finished to run 'git reset --hard' after each test so\nthat the repository is left in a saner state for the next test.\n\nThis is a step toward making the tests more independent so that if one\ntest fails it doesn't cause subsequent tests to fail.\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n t/t7610-mergetool.sh | 8 ++++++++\n 1 file changed, 8 insertions(+)\n\ndiff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh\nindex 2d92a2646..55587504e 100755\n--- a/t/t7610-mergetool.sh\n+++ b/t/t7610-mergetool.sh\n@@ -127,6 +127,7 @@ test_expect_success 'setup' '\n '\n \n test_expect_success 'custom mergetool' '\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \ttest_must_fail git merge master >/dev/null 2>&1 &&\n@@ -170,6 +171,7 @@ test_expect_success 'mergetool crlf' '\n '\n \n test_expect_success 'mergetool in subdir' '\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \t(\n@@ -181,6 +183,7 @@ test_expect_success 'mergetool in subdir' '\n '\n \n test_expect_success 'mergetool on file in parent dir' '\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit reset --hard &&\n \tgit submodule update -N &&\n \t(\n@@ -214,6 +217,7 @@ test_expect_success 'mergetool skips autoresolved' '\n '\n \n test_expect_success 'mergetool merges all from subdir' '\n+\ttest_when_finished \"git reset --hard\" &&\n \ttest_config rerere.enabled false &&\n \t(\n \t\tcd subdir &&\n@@ -244,6 +248,7 @@ test_expect_success 'mergetool skips resolved paths when rerere is active' '\n '\n \n test_expect_success 'conflicted stash sets up rerere'  '\n+\ttest_when_finished \"git reset --hard\" &&\n \ttest_config rerere.enabled true &&\n \tgit checkout stash1 &&\n \techo \"Conflicting stash content\" >file11 &&\n@@ -403,6 +408,7 @@ test_expect_success 'deleted vs modified submodule' '\n '\n \n test_expect_success 'file vs modified submodule' '\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \tmv submod submod-movedaside &&\n@@ -474,6 +480,7 @@ test_expect_success 'file vs modified submodule' '\n '\n \n test_expect_success 'submodule in subdirectory' '\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \t(\n@@ -535,6 +542,7 @@ test_expect_success 'submodule in subdirectory' '\n '\n \n test_expect_success 'directory vs modified submodule' '\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \tmv submod submod-movedaside &&\n \tgit rm --cached submod &&\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"308989","messageId":"20170109054238.42599-4-hansenr@google.com","threadId":"44811","inReplyTo":"20170109054238.42599-1-hansenr@google.com","subject":"[PATCH v3 03/13] t7610: Move setup code to the 'setup' test case.","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-09T05:42:28Z","receivedAt":"2017-01-09T05:43:20Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"Multiple test cases depend on these hunks, so move them to the 'setup'\ntest case.  This is a step toward making the tests more independent so\nthat if one test fails it doesn't cause subsequent tests to fail.\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n t/t7610-mergetool.sh | 65 ++++++++++++++++++++++++++++------------------------\n 1 file changed, 35 insertions(+), 30 deletions(-)\n\ndiff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh\nindex 14090739f..550838a1c 100755\n--- a/t/t7610-mergetool.sh\n+++ b/t/t7610-mergetool.sh\n@@ -55,6 +55,22 @@ test_expect_success 'setup' '\n \tgit rm file12 &&\n \tgit commit -m \"branch1 changes\" &&\n \n+\tgit checkout -b delete-base branch1 &&\n+\tmkdir -p a/a &&\n+\t(echo one; echo two; echo 3; echo 4) >a/a/file.txt &&\n+\tgit add a/a/file.txt &&\n+\tgit commit -m\"base file\" &&\n+\tgit checkout -b move-to-b delete-base &&\n+\tmkdir -p b/b &&\n+\tgit mv a/a/file.txt b/b/file.txt &&\n+\t(echo one; echo two; echo 4) >b/b/file.txt &&\n+\tgit commit -a -m\"move to b\" &&\n+\tgit checkout -b move-to-c delete-base &&\n+\tmkdir -p c/c &&\n+\tgit mv a/a/file.txt c/c/file.txt &&\n+\t(echo one; echo two; echo 3) >c/c/file.txt &&\n+\tgit commit -a -m\"move to c\" &&\n+\n \tgit checkout -b stash1 master &&\n \techo stash1 change file11 >file11 &&\n \tgit add file11 &&\n@@ -86,6 +102,23 @@ test_expect_success 'setup' '\n \tgit rm file11 &&\n \tgit commit -m \"master updates\" &&\n \n+\tgit clean -fdx &&\n+\tgit checkout -b order-file-start master &&\n+\techo start >a &&\n+\techo start >b &&\n+\tgit add a b &&\n+\tgit commit -m start &&\n+\tgit checkout -b order-file-side1 order-file-start &&\n+\techo side1 >a &&\n+\techo side1 >b &&\n+\tgit add a b &&\n+\tgit commit -m side1 &&\n+\tgit checkout -b order-file-side2 order-file-start &&\n+\techo side2 >a &&\n+\techo side2 >b &&\n+\tgit add a b &&\n+\tgit commit -m side2 &&\n+\n \tgit config merge.tool mytool &&\n \tgit config mergetool.mytool.cmd \"cat \\\"\\$REMOTE\\\" >\\\"\\$MERGED\\\"\" &&\n \tgit config mergetool.mytool.trustExitCode true &&\n@@ -244,21 +277,7 @@ test_expect_success 'mergetool takes partial path' '\n '\n \n test_expect_success 'mergetool delete/delete conflict' '\n-\tgit checkout -b delete-base branch1 &&\n-\tmkdir -p a/a &&\n-\t(echo one; echo two; echo 3; echo 4) >a/a/file.txt &&\n-\tgit add a/a/file.txt &&\n-\tgit commit -m\"base file\" &&\n-\tgit checkout -b move-to-b delete-base &&\n-\tmkdir -p b/b &&\n-\tgit mv a/a/file.txt b/b/file.txt &&\n-\t(echo one; echo two; echo 4) >b/b/file.txt &&\n-\tgit commit -a -m\"move to b\" &&\n-\tgit checkout -b move-to-c delete-base &&\n-\tmkdir -p c/c &&\n-\tgit mv a/a/file.txt c/c/file.txt &&\n-\t(echo one; echo two; echo 3) >c/c/file.txt &&\n-\tgit commit -a -m\"move to c\" &&\n+\tgit checkout move-to-c &&\n \ttest_must_fail git merge move-to-b &&\n \techo d | git mergetool a/a/file.txt &&\n \t! test -f a/a/file.txt &&\n@@ -607,26 +626,12 @@ test_expect_success MKTEMP 'temporary filenames are used with mergetool.writeToT\n '\n \n test_expect_success 'diff.orderFile configuration is honored' '\n+\tgit checkout order-file-side2 &&\n \ttest_config diff.orderFile order-file &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n \ttest_config mergetool.myecho.trustExitCode true &&\n \techo b >order-file &&\n \techo a >>order-file &&\n-\tgit checkout -b order-file-start master &&\n-\techo start >a &&\n-\techo start >b &&\n-\tgit add a b &&\n-\tgit commit -m start &&\n-\tgit checkout -b order-file-side1 order-file-start &&\n-\techo side1 >a &&\n-\techo side1 >b &&\n-\tgit add a b &&\n-\tgit commit -m side1 &&\n-\tgit checkout -b order-file-side2 order-file-start &&\n-\techo side2 >a &&\n-\techo side2 >b &&\n-\tgit add a b &&\n-\tgit commit -m side2 &&\n \ttest_must_fail git merge order-file-side1 &&\n \tcat >expect <<-\\EOF &&\n \t\tMerging:\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"308990","messageId":"20170109054238.42599-5-hansenr@google.com","threadId":"44811","inReplyTo":"20170109054238.42599-1-hansenr@google.com","subject":"[PATCH v3 04/13] t7610: use test_when_finished for cleanup tasks","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-09T05:42:29Z","receivedAt":"2017-01-09T05:43:22Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"This is a step toward making the tests more independent so that if one\ntest fails it doesn't cause subsequent tests to fail.\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n t/t7610-mergetool.sh | 71 +++++++++++++++++++++++++++-------------------------\n 1 file changed, 37 insertions(+), 34 deletions(-)\n\ndiff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh\nindex 550838a1c..f62ceffdc 100755\n--- a/t/t7610-mergetool.sh\n+++ b/t/t7610-mergetool.sh\n@@ -145,6 +145,11 @@ test_expect_success 'custom mergetool' '\n '\n \n test_expect_success 'mergetool crlf' '\n+\ttest_when_finished \"git reset --hard\" &&\n+\t# This test_config line must go after the above reset line so that\n+\t# core.autocrlf is unconfigured before reset runs.  (The\n+\t# test_config command uses test_when_finished internally and\n+\t# test_when_finished is LIFO.)\n \ttest_config core.autocrlf true &&\n \tgit checkout -b test$test_count branch1 &&\n \ttest_must_fail git merge master >/dev/null 2>&1 &&\n@@ -161,9 +166,7 @@ test_expect_success 'mergetool crlf' '\n \ttest \"$(printf x | cat subdir/file3 -)\" = \"$(printf \"master new sub\\r\\nx\")\" &&\n \tgit submodule update -N &&\n \ttest \"$(cat submod/bar)\" = \"master submodule\" &&\n-\tgit commit -m \"branch1 resolved with mergetool - autocrlf\" &&\n-\ttest_config core.autocrlf false &&\n-\tgit reset --hard\n+\tgit commit -m \"branch1 resolved with mergetool - autocrlf\"\n '\n \n test_expect_success 'mergetool in subdir' '\n@@ -194,6 +197,7 @@ test_expect_success 'mergetool on file in parent dir' '\n '\n \n test_expect_success 'mergetool skips autoresolved' '\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \ttest_must_fail git merge master &&\n@@ -202,8 +206,7 @@ test_expect_success 'mergetool skips autoresolved' '\n \t( yes \"d\" | git mergetool file12 >/dev/null 2>&1 ) &&\n \t( yes \"l\" | git mergetool submod >/dev/null 2>&1 ) &&\n \toutput=\"$(git mergetool --no-prompt)\" &&\n-\ttest \"$output\" = \"No files need merging\" &&\n-\tgit reset --hard\n+\ttest \"$output\" = \"No files need merging\"\n '\n \n test_expect_success 'mergetool merges all from subdir' '\n@@ -223,6 +226,7 @@ test_expect_success 'mergetool merges all from subdir' '\n '\n \n test_expect_success 'mergetool skips resolved paths when rerere is active' '\n+\ttest_when_finished \"git reset --hard\" &&\n \ttest_config rerere.enabled true &&\n \trm -rf .git/rr-cache &&\n \tgit checkout -b test$test_count branch1 &&\n@@ -232,8 +236,7 @@ test_expect_success 'mergetool skips resolved paths when rerere is active' '\n \t( yes \"d\" \"d\" | git mergetool --no-prompt >/dev/null 2>&1 ) &&\n \tgit submodule update -N &&\n \toutput=\"$(yes \"n\" | git mergetool --no-prompt)\" &&\n-\ttest \"$output\" = \"No files need merging\" &&\n-\tgit reset --hard\n+\ttest \"$output\" = \"No files need merging\"\n '\n \n test_expect_success 'conflicted stash sets up rerere'  '\n@@ -264,6 +267,7 @@ test_expect_success 'conflicted stash sets up rerere'  '\n '\n \n test_expect_success 'mergetool takes partial path' '\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit reset --hard &&\n \ttest_config rerere.enabled false &&\n \tgit checkout -b test$test_count branch1 &&\n@@ -272,11 +276,11 @@ test_expect_success 'mergetool takes partial path' '\n \n \t( yes \"\" | git mergetool subdir ) &&\n \n-\ttest \"$(cat subdir/file3)\" = \"master new sub\" &&\n-\tgit reset --hard\n+\ttest \"$(cat subdir/file3)\" = \"master new sub\"\n '\n \n test_expect_success 'mergetool delete/delete conflict' '\n+\ttest_when_finished \"git reset --hard HEAD\" &&\n \tgit checkout move-to-c &&\n \ttest_must_fail git merge move-to-b &&\n \techo d | git mergetool a/a/file.txt &&\n@@ -288,29 +292,30 @@ test_expect_success 'mergetool delete/delete conflict' '\n \tgit reset --hard HEAD &&\n \ttest_must_fail git merge move-to-b &&\n \t! echo a | git mergetool a/a/file.txt &&\n-\t! test -f a/a/file.txt &&\n-\tgit reset --hard HEAD\n+\t! test -f a/a/file.txt\n '\n \n test_expect_success 'mergetool produces no errors when keepBackup is used' '\n+\ttest_when_finished \"git reset --hard HEAD\" &&\n \ttest_config mergetool.keepBackup true &&\n \ttest_must_fail git merge move-to-b &&\n \t: >expect &&\n \techo d | git mergetool a/a/file.txt 2>actual &&\n \ttest_cmp expect actual &&\n-\t! test -d a &&\n-\tgit reset --hard HEAD\n+\t! test -d a\n '\n \n test_expect_success 'mergetool honors tempfile config for deleted files' '\n+\ttest_when_finished \"git reset --hard HEAD\" &&\n \ttest_config mergetool.keepTemporaries false &&\n \ttest_must_fail git merge move-to-b &&\n \techo d | git mergetool a/a/file.txt &&\n-\t! test -d a &&\n-\tgit reset --hard HEAD\n+\t! test -d a\n '\n \n test_expect_success 'mergetool keeps tempfiles when aborting delete/delete' '\n+\ttest_when_finished \"git reset --hard HEAD\" &&\n+\ttest_when_finished \"git clean -fdx\" &&\n \ttest_config mergetool.keepTemporaries true &&\n \ttest_must_fail git merge move-to-b &&\n \t! (echo a; echo n) | git mergetool a/a/file.txt &&\n@@ -321,12 +326,11 @@ test_expect_success 'mergetool keeps tempfiles when aborting delete/delete' '\n \tfile_REMOTE_.txt\n \tEOF\n \tls -1 a/a | sed -e \"s/[0-9]*//g\" >actual &&\n-\ttest_cmp expect actual &&\n-\tgit clean -fdx &&\n-\tgit reset --hard HEAD\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'deleted vs modified submodule' '\n+\ttest_when_finished \"git reset --hard HEAD\" &&\n \tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \tmv submod submod-movedaside &&\n@@ -391,8 +395,7 @@ test_expect_success 'deleted vs modified submodule' '\n \ttest \"$(cat submod/bar)\" = \"master submodule\" &&\n \toutput=\"$(git mergetool --no-prompt)\" &&\n \ttest \"$output\" = \"No files need merging\" &&\n-\tgit commit -m \"Merge resolved by keeping module\" &&\n-\tgit reset --hard HEAD\n+\tgit commit -m \"Merge resolved by keeping module\"\n '\n \n test_expect_success 'file vs modified submodule' '\n@@ -479,6 +482,7 @@ test_expect_success 'submodule in subdirectory' '\n \t\tgit commit -m \"add initial versions\"\n \t\t)\n \t) &&\n+\ttest_when_finished \"rm -rf subdir/subdir_module\" &&\n \tgit submodule add git://example.com/subsubmodule subdir/subdir_module &&\n \tgit add subdir/subdir_module &&\n \tgit commit -m \"add submodule in subdirectory\" &&\n@@ -523,8 +527,7 @@ test_expect_success 'submodule in subdirectory' '\n \ttest \"$(cat subdir/subdir_module/file15)\" = \"test$test_count.b\" &&\n \tgit submodule update -N &&\n \ttest \"$(cat subdir/subdir_module/file15)\" = \"test$test_count.a\" &&\n-\tgit commit -m \"branch1 resolved with mergetool\" &&\n-\trm -rf subdir/subdir_module\n+\tgit commit -m \"branch1 resolved with mergetool\"\n '\n \n test_expect_success 'directory vs modified submodule' '\n@@ -578,34 +581,34 @@ test_expect_success 'directory vs modified submodule' '\n '\n \n test_expect_success 'file with no base' '\n+\ttest_when_finished \"git reset --hard master >/dev/null 2>&1\" &&\n \tgit checkout -b test$test_count branch1 &&\n \ttest_must_fail git merge master &&\n \tgit mergetool --no-prompt --tool mybase -- both &&\n \t>expected &&\n-\ttest_cmp both expected &&\n-\tgit reset --hard master >/dev/null 2>&1\n+\ttest_cmp both expected\n '\n \n test_expect_success 'custom commands override built-ins' '\n+\ttest_when_finished \"git reset --hard master >/dev/null 2>&1\" &&\n \tgit checkout -b test$test_count branch1 &&\n \ttest_config mergetool.defaults.cmd \"cat \\\"\\$REMOTE\\\" >\\\"\\$MERGED\\\"\" &&\n \ttest_config mergetool.defaults.trustExitCode true &&\n \ttest_must_fail git merge master &&\n \tgit mergetool --no-prompt --tool defaults -- both &&\n \techo master both added >expected &&\n-\ttest_cmp both expected &&\n-\tgit reset --hard master >/dev/null 2>&1\n+\ttest_cmp both expected\n '\n \n test_expect_success 'filenames seen by tools start with ./' '\n+\ttest_when_finished \"git reset --hard master >/dev/null 2>&1\" &&\n \tgit checkout -b test$test_count branch1 &&\n \ttest_config mergetool.writeToTemp false &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n \ttest_config mergetool.myecho.trustExitCode true &&\n \ttest_must_fail git merge master &&\n \tgit mergetool --no-prompt --tool myecho -- both >actual &&\n-\tgrep ^\\./both_LOCAL_ actual >/dev/null &&\n-\tgit reset --hard master >/dev/null 2>&1\n+\tgrep ^\\./both_LOCAL_ actual >/dev/null\n '\n \n test_lazy_prereq MKTEMP '\n@@ -614,6 +617,7 @@ test_lazy_prereq MKTEMP '\n '\n \n test_expect_success MKTEMP 'temporary filenames are used with mergetool.writeToTemp' '\n+\ttest_when_finished \"git reset --hard master >/dev/null 2>&1\" &&\n \tgit checkout -b test$test_count branch1 &&\n \ttest_config mergetool.writeToTemp true &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n@@ -621,11 +625,11 @@ test_expect_success MKTEMP 'temporary filenames are used with mergetool.writeToT\n \ttest_must_fail git merge master &&\n \tgit mergetool --no-prompt --tool myecho -- both >actual &&\n \ttest_must_fail grep ^\\./both_LOCAL_ actual >/dev/null &&\n-\tgrep /both_LOCAL_ actual >/dev/null &&\n-\tgit reset --hard master >/dev/null 2>&1\n+\tgrep /both_LOCAL_ actual >/dev/null\n '\n \n test_expect_success 'diff.orderFile configuration is honored' '\n+\ttest_when_finished \"git reset --hard >/dev/null\" &&\n \tgit checkout order-file-side2 &&\n \ttest_config diff.orderFile order-file &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n@@ -640,10 +644,10 @@ test_expect_success 'diff.orderFile configuration is honored' '\n \tEOF\n \tgit mergetool --no-prompt --tool myecho >output &&\n \tgit grep --no-index -h -A2 Merging: output >actual &&\n-\ttest_cmp expect actual &&\n-\tgit reset --hard >/dev/null\n+\ttest_cmp expect actual\n '\n test_expect_success 'mergetool -Oorder-file is honored' '\n+\ttest_when_finished \"git reset --hard >/dev/null 2>&1\" &&\n \ttest_config diff.orderFile order-file &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n \ttest_config mergetool.myecho.trustExitCode true &&\n@@ -667,8 +671,7 @@ test_expect_success 'mergetool -Oorder-file is honored' '\n \tEOF\n \tgit mergetool -Oorder-file --no-prompt --tool myecho >output &&\n \tgit grep --no-index -h -A2 Merging: output >actual &&\n-\ttest_cmp expect actual &&\n-\tgit reset --hard >/dev/null 2>&1\n+\ttest_cmp expect actual\n '\n \n test_done\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"308991","messageId":"20170109054238.42599-8-hansenr@google.com","threadId":"44811","inReplyTo":"20170109054238.42599-1-hansenr@google.com","subject":"[PATCH v3 07/13] t7610: delete some now-unnecessary 'git reset --hard' lines","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-09T05:42:32Z","receivedAt":"2017-01-09T05:43:24Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"Tests now always run 'git reset --hard' at the end (even if they\nfail), so it's no longer necessary to run 'git reset --hard' at the\nbeginning of a test.\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n t/t7610-mergetool.sh | 2 --\n 1 file changed, 2 deletions(-)\n\ndiff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh\nindex 55587504e..7d5e1df88 100755\n--- a/t/t7610-mergetool.sh\n+++ b/t/t7610-mergetool.sh\n@@ -184,7 +184,6 @@ test_expect_success 'mergetool in subdir' '\n \n test_expect_success 'mergetool on file in parent dir' '\n \ttest_when_finished \"git reset --hard\" &&\n-\tgit reset --hard &&\n \tgit submodule update -N &&\n \t(\n \t\tcd subdir &&\n@@ -277,7 +276,6 @@ test_expect_success 'conflicted stash sets up rerere'  '\n \n test_expect_success 'mergetool takes partial path' '\n \ttest_when_finished \"git reset --hard\" &&\n-\tgit reset --hard &&\n \ttest_config rerere.enabled false &&\n \tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"308992","messageId":"20170109054238.42599-9-hansenr@google.com","threadId":"44811","inReplyTo":"20170109054238.42599-1-hansenr@google.com","subject":"[PATCH v3 08/13] t7610: always work on a test-specific branch","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-09T05:42:33Z","receivedAt":"2017-01-09T05:43:30Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"Create and use a test-specific branch when the test might create a\ncommit.  This is not always necessary for correctness, but it improves\ndebuggability by ensuring a commit created by test #N shows up on the\ntestN branch, not the branch for test #N-1.\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n t/t7610-mergetool.sh | 10 ++++++++--\n 1 file changed, 8 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh\nindex 7d5e1df88..efcf5c3f1 100755\n--- a/t/t7610-mergetool.sh\n+++ b/t/t7610-mergetool.sh\n@@ -184,6 +184,7 @@ test_expect_success 'mergetool in subdir' '\n \n test_expect_success 'mergetool on file in parent dir' '\n \ttest_when_finished \"git reset --hard\" &&\n+\tgit checkout -b test$test_count &&\n \tgit submodule update -N &&\n \t(\n \t\tcd subdir &&\n@@ -217,6 +218,7 @@ test_expect_success 'mergetool skips autoresolved' '\n \n test_expect_success 'mergetool merges all from subdir' '\n \ttest_when_finished \"git reset --hard\" &&\n+\tgit checkout -b test$test_count &&\n \ttest_config rerere.enabled false &&\n \t(\n \t\tcd subdir &&\n@@ -288,7 +290,7 @@ test_expect_success 'mergetool takes partial path' '\n \n test_expect_success 'mergetool delete/delete conflict' '\n \ttest_when_finished \"git reset --hard HEAD\" &&\n-\tgit checkout move-to-c &&\n+\tgit checkout -b test$test_count move-to-c &&\n \ttest_must_fail git merge move-to-b &&\n \techo d | git mergetool a/a/file.txt &&\n \t! test -f a/a/file.txt &&\n@@ -304,6 +306,7 @@ test_expect_success 'mergetool delete/delete conflict' '\n \n test_expect_success 'mergetool produces no errors when keepBackup is used' '\n \ttest_when_finished \"git reset --hard HEAD\" &&\n+\tgit checkout -b test$test_count &&\n \ttest_config mergetool.keepBackup true &&\n \ttest_must_fail git merge move-to-b &&\n \t: >expect &&\n@@ -314,6 +317,7 @@ test_expect_success 'mergetool produces no errors when keepBackup is used' '\n \n test_expect_success 'mergetool honors tempfile config for deleted files' '\n \ttest_when_finished \"git reset --hard HEAD\" &&\n+\tgit checkout -b test$test_count &&\n \ttest_config mergetool.keepTemporaries false &&\n \ttest_must_fail git merge move-to-b &&\n \techo d | git mergetool a/a/file.txt &&\n@@ -323,6 +327,7 @@ test_expect_success 'mergetool honors tempfile config for deleted files' '\n test_expect_success 'mergetool keeps tempfiles when aborting delete/delete' '\n \ttest_when_finished \"git reset --hard HEAD\" &&\n \ttest_when_finished \"git clean -fdx\" &&\n+\tgit checkout -b test$test_count &&\n \ttest_config mergetool.keepTemporaries true &&\n \ttest_must_fail git merge move-to-b &&\n \t! (echo a; echo n) | git mergetool a/a/file.txt &&\n@@ -640,7 +645,7 @@ test_expect_success MKTEMP 'temporary filenames are used with mergetool.writeToT\n \n test_expect_success 'diff.orderFile configuration is honored' '\n \ttest_when_finished \"git reset --hard >/dev/null\" &&\n-\tgit checkout order-file-side2 &&\n+\tgit checkout -b test$test_count order-file-side2 &&\n \ttest_config diff.orderFile order-file &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n \ttest_config mergetool.myecho.trustExitCode true &&\n@@ -658,6 +663,7 @@ test_expect_success 'diff.orderFile configuration is honored' '\n '\n test_expect_success 'mergetool -Oorder-file is honored' '\n \ttest_when_finished \"git reset --hard >/dev/null 2>&1\" &&\n+\tgit checkout -b test$test_count &&\n \ttest_config diff.orderFile order-file &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n \ttest_config mergetool.myecho.trustExitCode true &&\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"308993","messageId":"20170109054238.42599-14-hansenr@google.com","threadId":"44811","inReplyTo":"20170109054238.42599-1-hansenr@google.com","subject":"[PATCH v3 13/13] mergetool: fix running in subdir when rerere enabled","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-09T05:42:38Z","receivedAt":"2017-01-09T05:43:33Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"If rerere is enabled and no pathnames are given, run cd_to_toplevel\nbefore running 'git diff --name-only' so that 'git diff --name-only'\nsees the files named by 'git rerere remaining', which outputs\npathnames relative to the top-level directory.\n\nThe cd_to_toplevel command could be run after 'git rerere remaining',\nbut it is run before just in case 'git rerere remaining' is ever\nchanged to print pathnames relative to the current working directory\nrather than relative to the top-level directory.\n\nAn alternative approach would be to unconditionally convert all\nrelative pathnames (including the orderfile pathname) to be relative\nto the top-level directory and then run cd_to_toplevel before 'git\ndiff --name-only', but unfortunately 'git rev-parse --prefix' requires\nvalid pathnames, which would break some valid use cases.\n\nThis fixes a regression introduced in\n57937f70a09c12ef484c290865dac4066d207c9c (v2.11.0).\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n git-mergetool.sh     | 32 ++++++++++++++++++++++++++++++++\n t/t7610-mergetool.sh |  2 +-\n 2 files changed, 33 insertions(+), 1 deletion(-)\n\ndiff --git a/git-mergetool.sh b/git-mergetool.sh\nindex b506896dc..22f56c25a 100755\n--- a/git-mergetool.sh\n+++ b/git-mergetool.sh\n@@ -456,6 +456,28 @@ main () {\n \n \tif test $# -eq 0 && test -e \"$GIT_DIR/MERGE_RR\"\n \tthen\n+\t\t# The pathnames output by the 'git rerere remaining'\n+\t\t# command below are relative to the top-level\n+\t\t# directory but the 'git diff --name-only' command\n+\t\t# further below expects the pathnames to be relative\n+\t\t# to the current working directory.  Thus, we cd to\n+\t\t# the top-level directory before running 'git diff\n+\t\t# --name-only'.  We change directories even earlier\n+\t\t# (before running 'git rerere remaining') in case 'git\n+\t\t# rerere remaining' is ever changed to output\n+\t\t# pathnames relative to the current working directory.\n+\t\t#\n+\t\t# Changing directories breaks a relative $orderfile\n+\t\t# pathname argument, so fix it up to be relative to\n+\t\t# the top-level directory.\n+\n+\t\tprefix=$(git rev-parse --show-prefix) || exit 1\n+\t\tcd_to_toplevel\n+\t\tif test -n \"$orderfile\"\n+\t\tthen\n+\t\t\torderfile=$(git rev-parse --prefix \"$prefix\" \"$orderfile\") || exit 1\n+\t\tfi\n+\n \t\tset -- $(git rerere remaining)\n \t\tif test $# -eq 0\n \t\tthen\n@@ -463,6 +485,16 @@ main () {\n \t\tfi\n \tfi\n \n+\t# Note:  The pathnames output by 'git diff --name-only' are\n+\t# relative to the top-level directory, but it expects input\n+\t# pathnames to be relative to the current working directory.\n+\t# Thus:\n+\t#   * Either cd_to_toplevel must not be run before this or all\n+\t#     relative input pathnames must be converted to be\n+\t#     relative to the top-level directory (or absolute).\n+\t#   * Either cd_to_toplevel must be run after this or all\n+\t#     relative output pathnames must be converted to be\n+\t#     relative to the current working directory (or absolute).\n \tfiles=$(git -c core.quotePath=false \\\n \t\tdiff --name-only --diff-filter=U \\\n \t\t${orderfile:+\"-O$orderfile\"} -- \"$@\")\ndiff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh\nindex b36fde1c0..a55bf67e1 100755\n--- a/t/t7610-mergetool.sh\n+++ b/t/t7610-mergetool.sh\n@@ -234,7 +234,7 @@ test_expect_success 'mergetool merges all from subdir (rerere disabled)' '\n \t)\n '\n \n-test_expect_failure 'mergetool merges all from subdir (rerere enabled)' '\n+test_expect_success 'mergetool merges all from subdir (rerere enabled)' '\n \ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \ttest_config rerere.enabled true &&\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"308994","messageId":"20170109054238.42599-10-hansenr@google.com","threadId":"44811","inReplyTo":"20170109054238.42599-1-hansenr@google.com","subject":"[PATCH v3 09/13] t7610: don't assume the checked-out commit","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-09T05:42:34Z","receivedAt":"2017-01-09T05:43:34Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"Always check out the required commit at the beginning of the test so\nthat a failure in a previous test does not cause the test to work off\nof the wrong commit.\n\nThis is a step toward making the tests more independent so that if one\ntest fails it doesn't cause subsequent tests to fail.\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n t/t7610-mergetool.sh | 12 ++++++------\n 1 file changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh\nindex efcf5c3f1..54164a320 100755\n--- a/t/t7610-mergetool.sh\n+++ b/t/t7610-mergetool.sh\n@@ -184,7 +184,7 @@ test_expect_success 'mergetool in subdir' '\n \n test_expect_success 'mergetool on file in parent dir' '\n \ttest_when_finished \"git reset --hard\" &&\n-\tgit checkout -b test$test_count &&\n+\tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \t(\n \t\tcd subdir &&\n@@ -218,7 +218,7 @@ test_expect_success 'mergetool skips autoresolved' '\n \n test_expect_success 'mergetool merges all from subdir' '\n \ttest_when_finished \"git reset --hard\" &&\n-\tgit checkout -b test$test_count &&\n+\tgit checkout -b test$test_count branch1 &&\n \ttest_config rerere.enabled false &&\n \t(\n \t\tcd subdir &&\n@@ -306,7 +306,7 @@ test_expect_success 'mergetool delete/delete conflict' '\n \n test_expect_success 'mergetool produces no errors when keepBackup is used' '\n \ttest_when_finished \"git reset --hard HEAD\" &&\n-\tgit checkout -b test$test_count &&\n+\tgit checkout -b test$test_count move-to-c &&\n \ttest_config mergetool.keepBackup true &&\n \ttest_must_fail git merge move-to-b &&\n \t: >expect &&\n@@ -317,7 +317,7 @@ test_expect_success 'mergetool produces no errors when keepBackup is used' '\n \n test_expect_success 'mergetool honors tempfile config for deleted files' '\n \ttest_when_finished \"git reset --hard HEAD\" &&\n-\tgit checkout -b test$test_count &&\n+\tgit checkout -b test$test_count move-to-c &&\n \ttest_config mergetool.keepTemporaries false &&\n \ttest_must_fail git merge move-to-b &&\n \techo d | git mergetool a/a/file.txt &&\n@@ -327,7 +327,7 @@ test_expect_success 'mergetool honors tempfile config for deleted files' '\n test_expect_success 'mergetool keeps tempfiles when aborting delete/delete' '\n \ttest_when_finished \"git reset --hard HEAD\" &&\n \ttest_when_finished \"git clean -fdx\" &&\n-\tgit checkout -b test$test_count &&\n+\tgit checkout -b test$test_count move-to-c &&\n \ttest_config mergetool.keepTemporaries true &&\n \ttest_must_fail git merge move-to-b &&\n \t! (echo a; echo n) | git mergetool a/a/file.txt &&\n@@ -663,7 +663,7 @@ test_expect_success 'diff.orderFile configuration is honored' '\n '\n test_expect_success 'mergetool -Oorder-file is honored' '\n \ttest_when_finished \"git reset --hard >/dev/null 2>&1\" &&\n-\tgit checkout -b test$test_count &&\n+\tgit checkout -b test$test_count order-file-side2 &&\n \ttest_config diff.orderFile order-file &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n \ttest_config mergetool.myecho.trustExitCode true &&\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"308995","messageId":"20170109054238.42599-13-hansenr@google.com","threadId":"44811","inReplyTo":"20170109054238.42599-1-hansenr@google.com","subject":"[PATCH v3 12/13] mergetool: take the \"-O\" out of $orderfile","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-09T05:42:37Z","receivedAt":"2017-01-09T05:43:35Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"This will make it easier for a future commit to convert a relative\norderfile pathname to either absolute or relative to the top-level\ndirectory.  It also improves code readability.\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n git-mergetool.sh | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/git-mergetool.sh b/git-mergetool.sh\nindex e52b4e4f2..b506896dc 100755\n--- a/git-mergetool.sh\n+++ b/git-mergetool.sh\n@@ -421,7 +421,7 @@ main () {\n \t\t\tprompt=true\n \t\t\t;;\n \t\t-O*)\n-\t\t\torderfile=\"$1\"\n+\t\t\torderfile=\"${1#-O}\"\n \t\t\t;;\n \t\t--)\n \t\t\tshift\n@@ -465,7 +465,7 @@ main () {\n \n \tfiles=$(git -c core.quotePath=false \\\n \t\tdiff --name-only --diff-filter=U \\\n-\t\t${orderfile:+\"$orderfile\"} -- \"$@\")\n+\t\t${orderfile:+\"-O$orderfile\"} -- \"$@\")\n \n \tcd_to_toplevel\n \n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"308996","messageId":"20170109054238.42599-12-hansenr@google.com","threadId":"44811","inReplyTo":"20170109054238.42599-1-hansenr@google.com","subject":"[PATCH v3 11/13] t7610: add test case for rerere+mergetool+subdir bug","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-09T05:42:36Z","receivedAt":"2017-01-09T05:43:38Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"If rerere is enabled and mergetool is run from a subdirectory,\nmergetool always prints \"No files need merging\".  Add an expected\nfailure test case for this situation.\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n t/t7610-mergetool.sh | 21 ++++++++++++++++++++-\n 1 file changed, 20 insertions(+), 1 deletion(-)\n\ndiff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh\nindex c031ecd9e..b36fde1c0 100755\n--- a/t/t7610-mergetool.sh\n+++ b/t/t7610-mergetool.sh\n@@ -216,7 +216,7 @@ test_expect_success 'mergetool skips autoresolved' '\n \ttest \"$output\" = \"No files need merging\"\n '\n \n-test_expect_success 'mergetool merges all from subdir' '\n+test_expect_success 'mergetool merges all from subdir (rerere disabled)' '\n \ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \ttest_config rerere.enabled false &&\n@@ -234,6 +234,25 @@ test_expect_success 'mergetool merges all from subdir' '\n \t)\n '\n \n+test_expect_failure 'mergetool merges all from subdir (rerere enabled)' '\n+\ttest_when_finished \"git reset --hard\" &&\n+\tgit checkout -b test$test_count branch1 &&\n+\ttest_config rerere.enabled true &&\n+\trm -rf .git/rr-cache &&\n+\t(\n+\t\tcd subdir &&\n+\t\ttest_must_fail git merge master &&\n+\t\t( yes \"r\" | git mergetool ../submod ) &&\n+\t\t( yes \"d\" \"d\" | git mergetool --no-prompt ) &&\n+\t\ttest \"$(cat ../file1)\" = \"master updated\" &&\n+\t\ttest \"$(cat ../file2)\" = \"master new\" &&\n+\t\ttest \"$(cat file3)\" = \"master new sub\" &&\n+\t\t( cd .. && git submodule update -N ) &&\n+\t\ttest \"$(cat ../submod/bar)\" = \"master submodule\" &&\n+\t\tgit commit -m \"branch2 resolved by mergetool from subdir\"\n+\t)\n+'\n+\n test_expect_success 'mergetool skips resolved paths when rerere is active' '\n \ttest_when_finished \"git reset --hard\" &&\n \ttest_config rerere.enabled true &&\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"308997","messageId":"20170109054238.42599-11-hansenr@google.com","threadId":"44811","inReplyTo":"20170109054238.42599-1-hansenr@google.com","subject":"[PATCH v3 10/13] t7610: spell 'git reset --hard' consistently","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-09T05:42:35Z","receivedAt":"2017-01-09T05:43:46Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"Signed-off-by: Richard Hansen <hansenr@google.com>\n---\n t/t7610-mergetool.sh | 37 +++++++++++++++++++------------------\n 1 file changed, 19 insertions(+), 18 deletions(-)\n\ndiff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh\nindex 54164a320..c031ecd9e 100755\n--- a/t/t7610-mergetool.sh\n+++ b/t/t7610-mergetool.sh\n@@ -289,23 +289,23 @@ test_expect_success 'mergetool takes partial path' '\n '\n \n test_expect_success 'mergetool delete/delete conflict' '\n-\ttest_when_finished \"git reset --hard HEAD\" &&\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count move-to-c &&\n \ttest_must_fail git merge move-to-b &&\n \techo d | git mergetool a/a/file.txt &&\n \t! test -f a/a/file.txt &&\n-\tgit reset --hard HEAD &&\n+\tgit reset --hard &&\n \ttest_must_fail git merge move-to-b &&\n \techo m | git mergetool a/a/file.txt &&\n \ttest -f b/b/file.txt &&\n-\tgit reset --hard HEAD &&\n+\tgit reset --hard &&\n \ttest_must_fail git merge move-to-b &&\n \t! echo a | git mergetool a/a/file.txt &&\n \t! test -f a/a/file.txt\n '\n \n test_expect_success 'mergetool produces no errors when keepBackup is used' '\n-\ttest_when_finished \"git reset --hard HEAD\" &&\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count move-to-c &&\n \ttest_config mergetool.keepBackup true &&\n \ttest_must_fail git merge move-to-b &&\n@@ -316,7 +316,7 @@ test_expect_success 'mergetool produces no errors when keepBackup is used' '\n '\n \n test_expect_success 'mergetool honors tempfile config for deleted files' '\n-\ttest_when_finished \"git reset --hard HEAD\" &&\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count move-to-c &&\n \ttest_config mergetool.keepTemporaries false &&\n \ttest_must_fail git merge move-to-b &&\n@@ -325,7 +325,7 @@ test_expect_success 'mergetool honors tempfile config for deleted files' '\n '\n \n test_expect_success 'mergetool keeps tempfiles when aborting delete/delete' '\n-\ttest_when_finished \"git reset --hard HEAD\" &&\n+\ttest_when_finished \"git reset --hard\" &&\n \ttest_when_finished \"git clean -fdx\" &&\n \tgit checkout -b test$test_count move-to-c &&\n \ttest_config mergetool.keepTemporaries true &&\n@@ -342,7 +342,7 @@ test_expect_success 'mergetool keeps tempfiles when aborting delete/delete' '\n '\n \n test_expect_success 'deleted vs modified submodule' '\n-\ttest_when_finished \"git reset --hard HEAD\" &&\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \tmv submod submod-movedaside &&\n@@ -560,7 +560,7 @@ test_expect_success 'directory vs modified submodule' '\n \ttest \"$(cat submod/file16)\" = \"not a submodule\" &&\n \trm -rf submod.orig &&\n \n-\tgit reset --hard >/dev/null 2>&1 &&\n+\tgit reset --hard &&\n \ttest_must_fail git merge master &&\n \ttest -n \"$(git ls-files -u)\" &&\n \ttest ! -e submod.orig &&\n@@ -572,7 +572,8 @@ test_expect_success 'directory vs modified submodule' '\n \t( cd submod && git clean -f && git reset --hard ) &&\n \tgit submodule update -N &&\n \ttest \"$(cat submod/bar)\" = \"master submodule\" &&\n-\tgit reset --hard >/dev/null 2>&1 && rm -rf submod-movedaside &&\n+\tgit reset --hard &&\n+\trm -rf submod-movedaside &&\n \n \tgit checkout -b test$test_count.c master &&\n \tgit submodule update -N &&\n@@ -582,7 +583,7 @@ test_expect_success 'directory vs modified submodule' '\n \tgit submodule update -N &&\n \ttest \"$(cat submod/bar)\" = \"master submodule\" &&\n \n-\tgit reset --hard >/dev/null 2>&1 &&\n+\tgit reset --hard &&\n \tgit submodule update -N &&\n \ttest_must_fail git merge test$test_count &&\n \ttest -n \"$(git ls-files -u)\" &&\n@@ -590,13 +591,13 @@ test_expect_success 'directory vs modified submodule' '\n \t( yes \"r\" | git mergetool submod ) &&\n \ttest \"$(cat submod/file16)\" = \"not a submodule\" &&\n \n-\tgit reset --hard master >/dev/null 2>&1 &&\n+\tgit reset --hard master &&\n \t( cd submod && git clean -f && git reset --hard ) &&\n \tgit submodule update -N\n '\n \n test_expect_success 'file with no base' '\n-\ttest_when_finished \"git reset --hard master >/dev/null 2>&1\" &&\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \ttest_must_fail git merge master &&\n \tgit mergetool --no-prompt --tool mybase -- both &&\n@@ -605,7 +606,7 @@ test_expect_success 'file with no base' '\n '\n \n test_expect_success 'custom commands override built-ins' '\n-\ttest_when_finished \"git reset --hard master >/dev/null 2>&1\" &&\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \ttest_config mergetool.defaults.cmd \"cat \\\"\\$REMOTE\\\" >\\\"\\$MERGED\\\"\" &&\n \ttest_config mergetool.defaults.trustExitCode true &&\n@@ -616,7 +617,7 @@ test_expect_success 'custom commands override built-ins' '\n '\n \n test_expect_success 'filenames seen by tools start with ./' '\n-\ttest_when_finished \"git reset --hard master >/dev/null 2>&1\" &&\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \ttest_config mergetool.writeToTemp false &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n@@ -632,7 +633,7 @@ test_lazy_prereq MKTEMP '\n '\n \n test_expect_success MKTEMP 'temporary filenames are used with mergetool.writeToTemp' '\n-\ttest_when_finished \"git reset --hard master >/dev/null 2>&1\" &&\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \ttest_config mergetool.writeToTemp true &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n@@ -644,7 +645,7 @@ test_expect_success MKTEMP 'temporary filenames are used with mergetool.writeToT\n '\n \n test_expect_success 'diff.orderFile configuration is honored' '\n-\ttest_when_finished \"git reset --hard >/dev/null\" &&\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count order-file-side2 &&\n \ttest_config diff.orderFile order-file &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n@@ -662,7 +663,7 @@ test_expect_success 'diff.orderFile configuration is honored' '\n \ttest_cmp expect actual\n '\n test_expect_success 'mergetool -Oorder-file is honored' '\n-\ttest_when_finished \"git reset --hard >/dev/null 2>&1\" &&\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count order-file-side2 &&\n \ttest_config diff.orderFile order-file &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n@@ -678,7 +679,7 @@ test_expect_success 'mergetool -Oorder-file is honored' '\n \tgit mergetool -O/dev/null --no-prompt --tool myecho >output &&\n \tgit grep --no-index -h -A2 Merging: output >actual &&\n \ttest_cmp expect actual &&\n-\tgit reset --hard >/dev/null 2>&1 &&\n+\tgit reset --hard &&\n \n \tgit config --unset diff.orderFile &&\n \ttest_must_fail git merge order-file-side1 &&\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"308998","messageId":"20170109054238.42599-3-hansenr@google.com","threadId":"44811","inReplyTo":"20170109054238.42599-1-hansenr@google.com","subject":"[PATCH v3 02/13] t7610: update branch names to match test number","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-09T05:42:27Z","receivedAt":"2017-01-09T05:43:49Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"Rename the testNN branches so that NN matches the test number.  This\nshould make it easier to troubleshoot test issues.  Use $test_count to\nkeep this future-proof.\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n t/t7610-mergetool.sh | 82 ++++++++++++++++++++++++++--------------------------\n 1 file changed, 41 insertions(+), 41 deletions(-)\n\ndiff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh\nindex 6d9f21511..14090739f 100755\n--- a/t/t7610-mergetool.sh\n+++ b/t/t7610-mergetool.sh\n@@ -94,7 +94,7 @@ test_expect_success 'setup' '\n '\n \n test_expect_success 'custom mergetool' '\n-\tgit checkout -b test1 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \ttest_must_fail git merge master >/dev/null 2>&1 &&\n \t( yes \"\" | git mergetool both >/dev/null 2>&1 ) &&\n@@ -113,7 +113,7 @@ test_expect_success 'custom mergetool' '\n \n test_expect_success 'mergetool crlf' '\n \ttest_config core.autocrlf true &&\n-\tgit checkout -b test2 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \ttest_must_fail git merge master >/dev/null 2>&1 &&\n \t( yes \"\" | git mergetool file1 >/dev/null 2>&1 ) &&\n \t( yes \"\" | git mergetool file2 >/dev/null 2>&1 ) &&\n@@ -134,7 +134,7 @@ test_expect_success 'mergetool crlf' '\n '\n \n test_expect_success 'mergetool in subdir' '\n-\tgit checkout -b test3 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \t(\n \t\tcd subdir &&\n@@ -161,7 +161,7 @@ test_expect_success 'mergetool on file in parent dir' '\n '\n \n test_expect_success 'mergetool skips autoresolved' '\n-\tgit checkout -b test4 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \ttest_must_fail git merge master &&\n \ttest -n \"$(git ls-files -u)\" &&\n@@ -192,7 +192,7 @@ test_expect_success 'mergetool merges all from subdir' '\n test_expect_success 'mergetool skips resolved paths when rerere is active' '\n \ttest_config rerere.enabled true &&\n \trm -rf .git/rr-cache &&\n-\tgit checkout -b test5 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \ttest_must_fail git merge master >/dev/null 2>&1 &&\n \t( yes \"l\" | git mergetool --no-prompt submod >/dev/null 2>&1 ) &&\n@@ -233,7 +233,7 @@ test_expect_success 'conflicted stash sets up rerere'  '\n test_expect_success 'mergetool takes partial path' '\n \tgit reset --hard &&\n \ttest_config rerere.enabled false &&\n-\tgit checkout -b test12 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \ttest_must_fail git merge master &&\n \n@@ -308,12 +308,12 @@ test_expect_success 'mergetool keeps tempfiles when aborting delete/delete' '\n '\n \n test_expect_success 'deleted vs modified submodule' '\n-\tgit checkout -b test6 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \tmv submod submod-movedaside &&\n \tgit rm --cached submod &&\n \tgit commit -m \"Submodule deleted from branch\" &&\n-\tgit checkout -b test6.a test6 &&\n+\tgit checkout -b test$test_count.a test$test_count &&\n \ttest_must_fail git merge master &&\n \ttest -n \"$(git ls-files -u)\" &&\n \t( yes \"\" | git mergetool file1 file2 spaced\\ name subdir/file3 >/dev/null 2>&1 ) &&\n@@ -329,7 +329,7 @@ test_expect_success 'deleted vs modified submodule' '\n \tgit commit -m \"Merge resolved by keeping module\" &&\n \n \tmv submod submod-movedaside &&\n-\tgit checkout -b test6.b test6 &&\n+\tgit checkout -b test$test_count.b test$test_count &&\n \tgit submodule update -N &&\n \ttest_must_fail git merge master &&\n \ttest -n \"$(git ls-files -u)\" &&\n@@ -343,9 +343,9 @@ test_expect_success 'deleted vs modified submodule' '\n \tgit commit -m \"Merge resolved by deleting module\" &&\n \n \tmv submod-movedaside submod &&\n-\tgit checkout -b test6.c master &&\n+\tgit checkout -b test$test_count.c master &&\n \tgit submodule update -N &&\n-\ttest_must_fail git merge test6 &&\n+\ttest_must_fail git merge test$test_count &&\n \ttest -n \"$(git ls-files -u)\" &&\n \t( yes \"\" | git mergetool file1 file2 spaced\\ name subdir/file3 >/dev/null 2>&1 ) &&\n \t( yes \"\" | git mergetool both >/dev/null 2>&1 ) &&\n@@ -359,9 +359,9 @@ test_expect_success 'deleted vs modified submodule' '\n \tgit commit -m \"Merge resolved by deleting module\" &&\n \tmv submod.orig submod &&\n \n-\tgit checkout -b test6.d master &&\n+\tgit checkout -b test$test_count.d master &&\n \tgit submodule update -N &&\n-\ttest_must_fail git merge test6 &&\n+\ttest_must_fail git merge test$test_count &&\n \ttest -n \"$(git ls-files -u)\" &&\n \t( yes \"\" | git mergetool file1 file2 spaced\\ name subdir/file3 >/dev/null 2>&1 ) &&\n \t( yes \"\" | git mergetool both >/dev/null 2>&1 ) &&\n@@ -377,14 +377,14 @@ test_expect_success 'deleted vs modified submodule' '\n '\n \n test_expect_success 'file vs modified submodule' '\n-\tgit checkout -b test7 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \tmv submod submod-movedaside &&\n \tgit rm --cached submod &&\n \techo not a submodule >submod &&\n \tgit add submod &&\n \tgit commit -m \"Submodule path becomes file\" &&\n-\tgit checkout -b test7.a branch1 &&\n+\tgit checkout -b test$test_count.a branch1 &&\n \ttest_must_fail git merge master &&\n \ttest -n \"$(git ls-files -u)\" &&\n \t( yes \"\" | git mergetool file1 file2 spaced\\ name subdir/file3 >/dev/null 2>&1 ) &&\n@@ -400,7 +400,7 @@ test_expect_success 'file vs modified submodule' '\n \tgit commit -m \"Merge resolved by keeping module\" &&\n \n \tmv submod submod-movedaside &&\n-\tgit checkout -b test7.b test7 &&\n+\tgit checkout -b test$test_count.b test$test_count &&\n \ttest_must_fail git merge master &&\n \ttest -n \"$(git ls-files -u)\" &&\n \t( yes \"\" | git mergetool file1 file2 spaced\\ name subdir/file3 >/dev/null 2>&1 ) &&\n@@ -413,11 +413,11 @@ test_expect_success 'file vs modified submodule' '\n \ttest \"$output\" = \"No files need merging\" &&\n \tgit commit -m \"Merge resolved by keeping file\" &&\n \n-\tgit checkout -b test7.c master &&\n+\tgit checkout -b test$test_count.c master &&\n \trmdir submod && mv submod-movedaside submod &&\n \ttest ! -e submod.orig &&\n \tgit submodule update -N &&\n-\ttest_must_fail git merge test7 &&\n+\ttest_must_fail git merge test$test_count &&\n \ttest -n \"$(git ls-files -u)\" &&\n \t( yes \"\" | git mergetool file1 file2 spaced\\ name subdir/file3 >/dev/null 2>&1 ) &&\n \t( yes \"\" | git mergetool both >/dev/null 2>&1 ) &&\n@@ -430,10 +430,10 @@ test_expect_success 'file vs modified submodule' '\n \ttest \"$output\" = \"No files need merging\" &&\n \tgit commit -m \"Merge resolved by keeping file\" &&\n \n-\tgit checkout -b test7.d master &&\n+\tgit checkout -b test$test_count.d master &&\n \trmdir submod && mv submod.orig submod &&\n \tgit submodule update -N &&\n-\ttest_must_fail git merge test7 &&\n+\ttest_must_fail git merge test$test_count &&\n \ttest -n \"$(git ls-files -u)\" &&\n \t( yes \"\" | git mergetool file1 file2 spaced\\ name subdir/file3 >/dev/null 2>&1 ) &&\n \t( yes \"\" | git mergetool both>/dev/null 2>&1 ) &&\n@@ -448,7 +448,7 @@ test_expect_success 'file vs modified submodule' '\n '\n \n test_expect_success 'submodule in subdirectory' '\n-\tgit checkout -b test10 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \t(\n \t\tcd subdir &&\n@@ -464,52 +464,52 @@ test_expect_success 'submodule in subdirectory' '\n \tgit add subdir/subdir_module &&\n \tgit commit -m \"add submodule in subdirectory\" &&\n \n-\tgit checkout -b test10.a test10 &&\n+\tgit checkout -b test$test_count.a test$test_count &&\n \tgit submodule update -N &&\n \t(\n \tcd subdir/subdir_module &&\n \t\tgit checkout -b super10.a &&\n-\t\techo test10.a >file15 &&\n+\t\techo test$test_count.a >file15 &&\n \t\tgit add file15 &&\n \t\tgit commit -m \"on branch 10.a\"\n \t) &&\n \tgit add subdir/subdir_module &&\n-\tgit commit -m \"change submodule in subdirectory on test10.a\" &&\n+\tgit commit -m \"change submodule in subdirectory on test$test_count.a\" &&\n \n-\tgit checkout -b test10.b test10 &&\n+\tgit checkout -b test$test_count.b test$test_count &&\n \tgit submodule update -N &&\n \t(\n \t\tcd subdir/subdir_module &&\n \t\tgit checkout -b super10.b &&\n-\t\techo test10.b >file15 &&\n+\t\techo test$test_count.b >file15 &&\n \t\tgit add file15 &&\n \t\tgit commit -m \"on branch 10.b\"\n \t) &&\n \tgit add subdir/subdir_module &&\n-\tgit commit -m \"change submodule in subdirectory on test10.b\" &&\n+\tgit commit -m \"change submodule in subdirectory on test$test_count.b\" &&\n \n-\ttest_must_fail git merge test10.a >/dev/null 2>&1 &&\n+\ttest_must_fail git merge test$test_count.a >/dev/null 2>&1 &&\n \t(\n \t\tcd subdir &&\n \t\t( yes \"l\" | git mergetool subdir_module )\n \t) &&\n-\ttest \"$(cat subdir/subdir_module/file15)\" = \"test10.b\" &&\n+\ttest \"$(cat subdir/subdir_module/file15)\" = \"test$test_count.b\" &&\n \tgit submodule update -N &&\n-\ttest \"$(cat subdir/subdir_module/file15)\" = \"test10.b\" &&\n+\ttest \"$(cat subdir/subdir_module/file15)\" = \"test$test_count.b\" &&\n \tgit reset --hard &&\n \tgit submodule update -N &&\n \n-\ttest_must_fail git merge test10.a >/dev/null 2>&1 &&\n+\ttest_must_fail git merge test$test_count.a >/dev/null 2>&1 &&\n \t( yes \"r\" | git mergetool subdir/subdir_module ) &&\n-\ttest \"$(cat subdir/subdir_module/file15)\" = \"test10.b\" &&\n+\ttest \"$(cat subdir/subdir_module/file15)\" = \"test$test_count.b\" &&\n \tgit submodule update -N &&\n-\ttest \"$(cat subdir/subdir_module/file15)\" = \"test10.a\" &&\n+\ttest \"$(cat subdir/subdir_module/file15)\" = \"test$test_count.a\" &&\n \tgit commit -m \"branch1 resolved with mergetool\" &&\n \trm -rf subdir/subdir_module\n '\n \n test_expect_success 'directory vs modified submodule' '\n-\tgit checkout -b test11 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \tmv submod submod-movedaside &&\n \tgit rm --cached submod &&\n \tmkdir submod &&\n@@ -537,9 +537,9 @@ test_expect_success 'directory vs modified submodule' '\n \ttest \"$(cat submod/bar)\" = \"master submodule\" &&\n \tgit reset --hard >/dev/null 2>&1 && rm -rf submod-movedaside &&\n \n-\tgit checkout -b test11.c master &&\n+\tgit checkout -b test$test_count.c master &&\n \tgit submodule update -N &&\n-\ttest_must_fail git merge test11 &&\n+\ttest_must_fail git merge test$test_count &&\n \ttest -n \"$(git ls-files -u)\" &&\n \t( yes \"l\" | git mergetool submod ) &&\n \tgit submodule update -N &&\n@@ -547,7 +547,7 @@ test_expect_success 'directory vs modified submodule' '\n \n \tgit reset --hard >/dev/null 2>&1 &&\n \tgit submodule update -N &&\n-\ttest_must_fail git merge test11 &&\n+\ttest_must_fail git merge test$test_count &&\n \ttest -n \"$(git ls-files -u)\" &&\n \ttest ! -e submod.orig &&\n \t( yes \"r\" | git mergetool submod ) &&\n@@ -559,7 +559,7 @@ test_expect_success 'directory vs modified submodule' '\n '\n \n test_expect_success 'file with no base' '\n-\tgit checkout -b test13 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \ttest_must_fail git merge master &&\n \tgit mergetool --no-prompt --tool mybase -- both &&\n \t>expected &&\n@@ -568,7 +568,7 @@ test_expect_success 'file with no base' '\n '\n \n test_expect_success 'custom commands override built-ins' '\n-\tgit checkout -b test14 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \ttest_config mergetool.defaults.cmd \"cat \\\"\\$REMOTE\\\" >\\\"\\$MERGED\\\"\" &&\n \ttest_config mergetool.defaults.trustExitCode true &&\n \ttest_must_fail git merge master &&\n@@ -579,7 +579,7 @@ test_expect_success 'custom commands override built-ins' '\n '\n \n test_expect_success 'filenames seen by tools start with ./' '\n-\tgit checkout -b test15 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \ttest_config mergetool.writeToTemp false &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n \ttest_config mergetool.myecho.trustExitCode true &&\n@@ -595,7 +595,7 @@ test_lazy_prereq MKTEMP '\n '\n \n test_expect_success MKTEMP 'temporary filenames are used with mergetool.writeToTemp' '\n-\tgit checkout -b test16 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \ttest_config mergetool.writeToTemp true &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n \ttest_config mergetool.myecho.trustExitCode true &&\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"309046","messageId":"xmqq4m18ump1.fsf@gitster.mtv.corp.google.com","threadId":"44811","inReplyTo":"20170109054238.42599-14-hansenr@google.com","subject":"Re: [PATCH v3 13/13] mergetool: fix running in subdir when rerere enabled","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-01-09T18:12:42Z","receivedAt":"2017-01-09T18:12:55Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Richard Hansen <hansenr@google.com> writes:\n\n> If rerere is enabled and no pathnames are given, run cd_to_toplevel\n> before running 'git diff --name-only' so that 'git diff --name-only'\n> sees the files named by 'git rerere remaining', which outputs\n> pathnames relative to the top-level directory.\n>\n> The cd_to_toplevel command could be run after 'git rerere remaining',\n> but it is run before just in case 'git rerere remaining' is ever\n> changed to print pathnames relative to the current working directory\n> rather than relative to the top-level directory.\n>\n> An alternative approach would be to unconditionally convert all\n> relative pathnames (including the orderfile pathname) to be relative\n> to the top-level directory and then run cd_to_toplevel before 'git\n> diff --name-only', but unfortunately 'git rev-parse --prefix' requires\n> valid pathnames, which would break some valid use cases.\n>\n> This fixes a regression introduced in\n> 57937f70a09c12ef484c290865dac4066d207c9c (v2.11.0).\n>\n> Signed-off-by: Richard Hansen <hansenr@google.com>\n> ---\n>  git-mergetool.sh     | 32 ++++++++++++++++++++++++++++++++\n>  t/t7610-mergetool.sh |  2 +-\n>  2 files changed, 33 insertions(+), 1 deletion(-)\n>\n> diff --git a/git-mergetool.sh b/git-mergetool.sh\n> index b506896dc..22f56c25a 100755\n> --- a/git-mergetool.sh\n> +++ b/git-mergetool.sh\n> @@ -456,6 +456,28 @@ main () {\n>  \n\nWhile doing the extra cd_to_toplevel added by this patch may not\nbreak anything that comes after the existing cd_to_toplevel, I find\nthe result of applying this patch unnecessarily confusing.  As \"if\nthe user didn't give any pathnames from the command line, ask rerere\nwhat paths it thinks are necessary to be handled\" is merely a\nlaziness fallback, it feels conceptually wrong to use different\ninvocations of -O$orderfile when rerere is and is not in effect.\n\nI wonder if it makes more sense to always move to toplevel upfront\nand consistently use path from the toplevel, perhaps like the patch\ndoes.  The first hunk is what you wrote but only inside MERGE_RR\nblock, and the second hunk deals with converting end-user supplied\npaths that are relative to the original relative to the top-level.\n\nThe tweaking of $orderfile you have in the first hunk may have to be\ntightened mimicking the way how \"eval ... --sq ... ; shift\" is used\nin the second hunk to avoid confusion in case orderfile specified by\nthe end user happens to be the same as a valid revname\n(e.g. \"master\").\n\n\ndiff --git a/git-mergetool.sh b/git-mergetool.sh\nindex b506896dc1..adbbeceb47 100755\n--- a/git-mergetool.sh\n+++ b/git-mergetool.sh\n@@ -454,6 +454,14 @@ main () {\n \tmerge_keep_backup=\"$(git config --bool mergetool.keepBackup || echo true)\"\n \tmerge_keep_temporaries=\"$(git config --bool mergetool.keepTemporaries || echo false)\"\n \n+\tprefix=$(git rev-parse --show-prefix) || exit 1\n+\tcd_to_toplevel\n+\n+\tif test -n \"$orderfile\"\n+\tthen\n+\t\torderfile=$(git rev-parse --prefix \"$prefix\" \"$orderfile\") || exit 1\n+\tfi\n+\n \tif test $# -eq 0 && test -e \"$GIT_DIR/MERGE_RR\"\n \tthen\n \t\tset -- $(git rerere remaining)\n@@ -461,14 +469,16 @@ main () {\n \t\tthen\n \t\t\tprint_noop_and_exit\n \t\tfi\n+\telif test $# -ge 0\n+\tthen\n+\t\teval \"set -- $(git rev-parse --sq --prefix \"$prefix\" -- \"$@\")\"\n+\t\tshift\n \tfi\n \n \tfiles=$(git -c core.quotePath=false \\\n \t\tdiff --name-only --diff-filter=U \\\n \t\t${orderfile:+\"-O$orderfile\"} -- \"$@\")\n \n-\tcd_to_toplevel\n-\n \tif test -z \"$files\"\n \tthen\n \t\tprint_noop_and_exit\n"},{"id":"309049","messageId":"CAGZ79kZHrkwBigEQbG6GoEAbuN=U0A3e9Vhz6btohYsnUHMYog@mail.gmail.com","threadId":"44811","inReplyTo":"20170109054238.42599-1-hansenr@google.com","subject":"Re: [PATCH v3 00/13] fix mergetool+rerere+subdir regression","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2017-01-09T18:49:46Z","receivedAt":"2017-01-09T18:49:53Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Sun, Jan 8, 2017 at 9:42 PM, Richard Hansen <hansenr@google.com> wrote:\n> If rerere is enabled, no pathnames are given, and mergetool is run\n> from a subdirectory, mergetool always prints \"No files need merging\".\n> Fix the bug.\n>\n> This regression was introduced in\n> 57937f70a09c12ef484c290865dac4066d207c9c (v2.11.0).\n>\n> Changes since v2:\n>   * Added entries to .mailmap.\n>   * Patch 2/4 was split into multiple separate commits.\n>   * Moved '-O' out of $orderfile.\n>   * $orderfile is now adjusted after running cd_to_toplevel.\n>   * Added lots of comments.\n>   * Other minor tweaks to address review feedback.\n>\n\nThe changes to tests look all good to me.\n\nThanks,\nStefan\n"},{"id":"309053","messageId":"xmqqvatot5ob.fsf@gitster.mtv.corp.google.com","threadId":"44811","inReplyTo":"xmqq4m18ump1.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH v3 13/13] mergetool: fix running in subdir when rerere enabled","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-01-09T19:05:40Z","receivedAt":"2017-01-09T19:05:50Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> I wonder if it makes more sense to always move to toplevel upfront\n> and consistently use path from the toplevel, perhaps like the patch\n\ns/the patch/the attached patch/ I meant.\n\n> does.  The first hunk is what you wrote but only inside MERGE_RR\n> block, and the second hunk deals with converting end-user supplied\n> paths that are relative to the original relative to the top-level.\n>\n> The tweaking of $orderfile you have in the first hunk may have to be\n> tightened mimicking the way how \"eval ... --sq ... ; shift\" is used\n> in the second hunk to avoid confusion in case orderfile specified by\n> the end user happens to be the same as a valid revname\n> (e.g. \"master\").\n\nAnd here is a squash-able patch to illustrate what I mean.\n\nI removed both of the comment blocks as the code always works with\nthe worktree-relative pathname after this patch while adjusting\nend-user supplied paths from relative to original cwd.  As that is\nhow the core parts of the system (including the parts written in C)\nwork, even though an explanation you did in the log message is\nneeded to explain why the change was needed and what the change\nintended to do to readers of \"git log\", it is not necessary to\nexplain it to the readers of the latest code, which is what the\nin-code comment is about.\n\nThe single-liner addition to the test creates a branch whose name is\nthe same as the specified orderfile to deliberately create a\nconfusing situation.  I haven't tried, but I am fairly sure that the\ntest will demonstrate how broken the orderfile=$(...) in the\noriginal is, if you apply the test part of the attached patch,\nwithout the changes to git-mergetool.sh, to your version.\n\n\ndiff --git a/git-mergetool.sh b/git-mergetool.sh\nindex 22f56c25a2..21f82d5b58 100755\n--- a/git-mergetool.sh\n+++ b/git-mergetool.sh\n@@ -454,53 +454,34 @@ main () {\n \tmerge_keep_backup=\"$(git config --bool mergetool.keepBackup || echo true)\"\n \tmerge_keep_temporaries=\"$(git config --bool mergetool.keepTemporaries || echo false)\"\n \n-\tif test $# -eq 0 && test -e \"$GIT_DIR/MERGE_RR\"\n+\tprefix=$(git rev-parse --show-prefix) || exit 1\n+\tcd_to_toplevel\n+\n+\tif test -n \"$orderfile\"\n \tthen\n-\t\t# The pathnames output by the 'git rerere remaining'\n-\t\t# command below are relative to the top-level\n-\t\t# directory but the 'git diff --name-only' command\n-\t\t# further below expects the pathnames to be relative\n-\t\t# to the current working directory.  Thus, we cd to\n-\t\t# the top-level directory before running 'git diff\n-\t\t# --name-only'.  We change directories even earlier\n-\t\t# (before running 'git rerere remaining') in case 'git\n-\t\t# rerere remaining' is ever changed to output\n-\t\t# pathnames relative to the current working directory.\n-\t\t#\n-\t\t# Changing directories breaks a relative $orderfile\n-\t\t# pathname argument, so fix it up to be relative to\n-\t\t# the top-level directory.\n-\n-\t\tprefix=$(git rev-parse --show-prefix) || exit 1\n-\t\tcd_to_toplevel\n-\t\tif test -n \"$orderfile\"\n-\t\tthen\n-\t\t\torderfile=$(git rev-parse --prefix \"$prefix\" \"$orderfile\") || exit 1\n-\t\tfi\n+\t\torderfile=$(\n+\t\t\tgit rev-parse --prefix \"$prefix\" -- \"$orderfile\" |\n+\t\t\tsed -e 1d\n+\t\t)\n+\tfi\n \n+\tif test $# -eq 0 && test -e \"$GIT_DIR/MERGE_RR\"\n+\tthen\n \t\tset -- $(git rerere remaining)\n \t\tif test $# -eq 0\n \t\tthen\n \t\t\tprint_noop_and_exit\n \t\tfi\n+\telif test $# -ge 0\n+\tthen\n+\t\teval \"set -- $(git rev-parse --sq --prefix \"$prefix\" -- \"$@\")\"\n+\t\tshift\n \tfi\n \n-\t# Note:  The pathnames output by 'git diff --name-only' are\n-\t# relative to the top-level directory, but it expects input\n-\t# pathnames to be relative to the current working directory.\n-\t# Thus:\n-\t#   * Either cd_to_toplevel must not be run before this or all\n-\t#     relative input pathnames must be converted to be\n-\t#     relative to the top-level directory (or absolute).\n-\t#   * Either cd_to_toplevel must be run after this or all\n-\t#     relative output pathnames must be converted to be\n-\t#     relative to the current working directory (or absolute).\n \tfiles=$(git -c core.quotePath=false \\\n \t\tdiff --name-only --diff-filter=U \\\n \t\t${orderfile:+\"-O$orderfile\"} -- \"$@\")\n \n-\tcd_to_toplevel\n-\n \tif test -z \"$files\"\n \tthen\n \t\tprint_noop_and_exit\ndiff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh\nindex dfd641d34b..180dd7057a 100755\n--- a/t/t7610-mergetool.sh\n+++ b/t/t7610-mergetool.sh\n@@ -678,6 +678,11 @@ test_expect_success 'diff.orderFile configuration is honored' '\n \t\tb\n \t\ta\n \tEOF\n+\n+\t# make sure \"order-file\" that is ambiguous between\n+\t# rev and path is understood correctly.\n+\tgit branch order-file HEAD &&\n+\n \tgit mergetool --no-prompt --tool myecho >output &&\n \tgit grep --no-index -h -A2 Merging: output >actual &&\n \ttest_cmp expect actual\n"},{"id":"309063","messageId":"babb5073-97d1-3d03-02a5-9c690e86b8a0@kdbg.org","threadId":"44811","inReplyTo":"xmqqvatot5ob.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH v3 13/13] mergetool: fix running in subdir when rerere enabled","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2017-01-09T19:53:15Z","receivedAt":"2017-01-09T19:53:24Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 09.01.2017 um 20:05 schrieb Junio C Hamano:\n> Junio C Hamano <gitster@pobox.com> writes:\n>\n>> I wonder if it makes more sense to always move to toplevel upfront\n>> and consistently use path from the toplevel, perhaps like the patch\n>\n> s/the patch/the attached patch/ I meant.\n>\n>> does.  The first hunk is what you wrote but only inside MERGE_RR\n>> block, and the second hunk deals with converting end-user supplied\n>> paths that are relative to the original relative to the top-level.\n>>\n>> The tweaking of $orderfile you have in the first hunk may have to be\n>> tightened mimicking the way how \"eval ... --sq ... ; shift\" is used\n>> in the second hunk to avoid confusion in case orderfile specified by\n>> the end user happens to be the same as a valid revname\n>> (e.g. \"master\").\n>\n> And here is a squash-able patch to illustrate what I mean.\n>\n> I removed both of the comment blocks as the code always works with\n> the worktree-relative pathname after this patch while adjusting\n> end-user supplied paths from relative to original cwd.  As that is\n> how the core parts of the system (including the parts written in C)\n> work, even though an explanation you did in the log message is\n> needed to explain why the change was needed and what the change\n> intended to do to readers of \"git log\", it is not necessary to\n> explain it to the readers of the latest code, which is what the\n> in-code comment is about.\n>\n> The single-liner addition to the test creates a branch whose name is\n> the same as the specified orderfile to deliberately create a\n> confusing situation.  I haven't tried, but I am fairly sure that the\n> test will demonstrate how broken the orderfile=$(...) in the\n> original is, if you apply the test part of the attached patch,\n> without the changes to git-mergetool.sh, to your version.\n>\n>\n> diff --git a/git-mergetool.sh b/git-mergetool.sh\n> index 22f56c25a2..21f82d5b58 100755\n> --- a/git-mergetool.sh\n> +++ b/git-mergetool.sh\n> @@ -454,53 +454,34 @@ main () {\n>  \tmerge_keep_backup=\"$(git config --bool mergetool.keepBackup || echo true)\"\n>  \tmerge_keep_temporaries=\"$(git config --bool mergetool.keepTemporaries || echo false)\"\n>\n> -\tif test $# -eq 0 && test -e \"$GIT_DIR/MERGE_RR\"\n> +\tprefix=$(git rev-parse --show-prefix) || exit 1\n> +\tcd_to_toplevel\n> +\n> +\tif test -n \"$orderfile\"\n>  \tthen\n> -\t\t# The pathnames output by the 'git rerere remaining'\n> -\t\t# command below are relative to the top-level\n> -\t\t# directory but the 'git diff --name-only' command\n> -\t\t# further below expects the pathnames to be relative\n> -\t\t# to the current working directory.  Thus, we cd to\n> -\t\t# the top-level directory before running 'git diff\n> -\t\t# --name-only'.  We change directories even earlier\n> -\t\t# (before running 'git rerere remaining') in case 'git\n> -\t\t# rerere remaining' is ever changed to output\n> -\t\t# pathnames relative to the current working directory.\n> -\t\t#\n> -\t\t# Changing directories breaks a relative $orderfile\n> -\t\t# pathname argument, so fix it up to be relative to\n> -\t\t# the top-level directory.\n> -\n> -\t\tprefix=$(git rev-parse --show-prefix) || exit 1\n> -\t\tcd_to_toplevel\n> -\t\tif test -n \"$orderfile\"\n> -\t\tthen\n> -\t\t\torderfile=$(git rev-parse --prefix \"$prefix\" \"$orderfile\") || exit 1\n> -\t\tfi\n> +\t\torderfile=$(\n> +\t\t\tgit rev-parse --prefix \"$prefix\" -- \"$orderfile\" |\n> +\t\t\tsed -e 1d\n> +\t\t)\n> +\tfi\n>\n> +\tif test $# -eq 0 && test -e \"$GIT_DIR/MERGE_RR\"\n> +\tthen\n>  \t\tset -- $(git rerere remaining)\n>  \t\tif test $# -eq 0\n>  \t\tthen\n>  \t\t\tprint_noop_and_exit\n>  \t\tfi\n> +\telif test $# -ge 0\n> +\tthen\n> +\t\teval \"set -- $(git rev-parse --sq --prefix \"$prefix\" -- \"$@\")\"\n> +\t\tshift\n>  \tfi\n>\n> -\t# Note:  The pathnames output by 'git diff --name-only' are\n> -\t# relative to the top-level directory, but it expects input\n> -\t# pathnames to be relative to the current working directory.\n> -\t# Thus:\n> -\t#   * Either cd_to_toplevel must not be run before this or all\n> -\t#     relative input pathnames must be converted to be\n> -\t#     relative to the top-level directory (or absolute).\n> -\t#   * Either cd_to_toplevel must be run after this or all\n> -\t#     relative output pathnames must be converted to be\n> -\t#     relative to the current working directory (or absolute).\n>  \tfiles=$(git -c core.quotePath=false \\\n>  \t\tdiff --name-only --diff-filter=U \\\n>  \t\t${orderfile:+\"-O$orderfile\"} -- \"$@\")\n>\n> -\tcd_to_toplevel\n> -\n>  \tif test -z \"$files\"\n>  \tthen\n>  \t\tprint_noop_and_exit\n\nThe control flow after this patch looks much more like what I had in \nmind. Thanks.\n\n-- Hannes\n\n"},{"id":"309075","messageId":"472a8db7-a2d1-5f3a-a43c-0942e744f90b@google.com","threadId":"44811","inReplyTo":"xmqqvatot5ob.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH v3 13/13] mergetool: fix running in subdir when rerere enabled","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-09T22:57:33Z","receivedAt":"2017-01-09T22:57:41Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"On 2017-01-09 14:05, Junio C Hamano wrote:\n> Junio C Hamano <gitster@pobox.com> writes:\n>\n>> I wonder if it makes more sense to always move to toplevel upfront\n>> and consistently use path from the toplevel, perhaps like the patch\n>\n> s/the patch/the attached patch/ I meant.\n>\n>> does.  The first hunk is what you wrote but only inside MERGE_RR\n>> block, and the second hunk deals with converting end-user supplied\n>> paths that are relative to the original relative to the top-level.\n>>\n>> The tweaking of $orderfile you have in the first hunk may have to be\n>> tightened mimicking the way how \"eval ... --sq ... ; shift\" is used\n>> in the second hunk to avoid confusion in case orderfile specified by\n>> the end user happens to be the same as a valid revname\n>> (e.g. \"master\").\n>\n> And here is a squash-able patch to illustrate what I mean.\n\nThanks for this; I'll cook up a reroll.\n\nI tried this approach before I emailed the v3 reroll, except I left out \nthe \"--\" argument to rev-parse.  This caused the tests to fail due to \n\"ambiguous argument: unknown revision or path not in the working tree\". \nI didn't think to add the \"--\" because I got it in my head that \"--\" \nshouldn't be used with --prefix because it shows up in the output, plus \nthe example in the rev-parse documentation doesn't use it.  I'll patch \nrev-parse's man page to use \"--\" in the example.\n\nThanks,\nRichard\n\n>\n> I removed both of the comment blocks as the code always works with\n> the worktree-relative pathname after this patch while adjusting\n> end-user supplied paths from relative to original cwd.  As that is\n> how the core parts of the system (including the parts written in C)\n> work, even though an explanation you did in the log message is\n> needed to explain why the change was needed and what the change\n> intended to do to readers of \"git log\", it is not necessary to\n> explain it to the readers of the latest code, which is what the\n> in-code comment is about.\n>\n> The single-liner addition to the test creates a branch whose name is\n> the same as the specified orderfile to deliberately create a\n> confusing situation.  I haven't tried, but I am fairly sure that the\n> test will demonstrate how broken the orderfile=$(...) in the\n> original is, if you apply the test part of the attached patch,\n> without the changes to git-mergetool.sh, to your version.\n>\n>\n> diff --git a/git-mergetool.sh b/git-mergetool.sh\n> index 22f56c25a2..21f82d5b58 100755\n> --- a/git-mergetool.sh\n> +++ b/git-mergetool.sh\n> @@ -454,53 +454,34 @@ main () {\n>  \tmerge_keep_backup=\"$(git config --bool mergetool.keepBackup || echo true)\"\n>  \tmerge_keep_temporaries=\"$(git config --bool mergetool.keepTemporaries || echo false)\"\n>\n> -\tif test $# -eq 0 && test -e \"$GIT_DIR/MERGE_RR\"\n> +\tprefix=$(git rev-parse --show-prefix) || exit 1\n> +\tcd_to_toplevel\n> +\n> +\tif test -n \"$orderfile\"\n>  \tthen\n> -\t\t# The pathnames output by the 'git rerere remaining'\n> -\t\t# command below are relative to the top-level\n> -\t\t# directory but the 'git diff --name-only' command\n> -\t\t# further below expects the pathnames to be relative\n> -\t\t# to the current working directory.  Thus, we cd to\n> -\t\t# the top-level directory before running 'git diff\n> -\t\t# --name-only'.  We change directories even earlier\n> -\t\t# (before running 'git rerere remaining') in case 'git\n> -\t\t# rerere remaining' is ever changed to output\n> -\t\t# pathnames relative to the current working directory.\n> -\t\t#\n> -\t\t# Changing directories breaks a relative $orderfile\n> -\t\t# pathname argument, so fix it up to be relative to\n> -\t\t# the top-level directory.\n> -\n> -\t\tprefix=$(git rev-parse --show-prefix) || exit 1\n> -\t\tcd_to_toplevel\n> -\t\tif test -n \"$orderfile\"\n> -\t\tthen\n> -\t\t\torderfile=$(git rev-parse --prefix \"$prefix\" \"$orderfile\") || exit 1\n> -\t\tfi\n> +\t\torderfile=$(\n> +\t\t\tgit rev-parse --prefix \"$prefix\" -- \"$orderfile\" |\n> +\t\t\tsed -e 1d\n> +\t\t)\n> +\tfi\n>\n> +\tif test $# -eq 0 && test -e \"$GIT_DIR/MERGE_RR\"\n> +\tthen\n>  \t\tset -- $(git rerere remaining)\n>  \t\tif test $# -eq 0\n>  \t\tthen\n>  \t\t\tprint_noop_and_exit\n>  \t\tfi\n> +\telif test $# -ge 0\n> +\tthen\n> +\t\teval \"set -- $(git rev-parse --sq --prefix \"$prefix\" -- \"$@\")\"\n> +\t\tshift\n>  \tfi\n>\n> -\t# Note:  The pathnames output by 'git diff --name-only' are\n> -\t# relative to the top-level directory, but it expects input\n> -\t# pathnames to be relative to the current working directory.\n> -\t# Thus:\n> -\t#   * Either cd_to_toplevel must not be run before this or all\n> -\t#     relative input pathnames must be converted to be\n> -\t#     relative to the top-level directory (or absolute).\n> -\t#   * Either cd_to_toplevel must be run after this or all\n> -\t#     relative output pathnames must be converted to be\n> -\t#     relative to the current working directory (or absolute).\n>  \tfiles=$(git -c core.quotePath=false \\\n>  \t\tdiff --name-only --diff-filter=U \\\n>  \t\t${orderfile:+\"-O$orderfile\"} -- \"$@\")\n>\n> -\tcd_to_toplevel\n> -\n>  \tif test -z \"$files\"\n>  \tthen\n>  \t\tprint_noop_and_exit\n> diff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh\n> index dfd641d34b..180dd7057a 100755\n> --- a/t/t7610-mergetool.sh\n> +++ b/t/t7610-mergetool.sh\n> @@ -678,6 +678,11 @@ test_expect_success 'diff.orderFile configuration is honored' '\n>  \t\tb\n>  \t\ta\n>  \tEOF\n> +\n> +\t# make sure \"order-file\" that is ambiguous between\n> +\t# rev and path is understood correctly.\n> +\tgit branch order-file HEAD &&\n> +\n>  \tgit mergetool --no-prompt --tool myecho >output &&\n>  \tgit grep --no-index -h -A2 Merging: output >actual &&\n>  \ttest_cmp expect actual\n>\n"},{"id":"309079","messageId":"xmqq37gru819.fsf@gitster.mtv.corp.google.com","threadId":"44811","inReplyTo":"xmqqvatot5ob.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH v3 13/13] mergetool: fix running in subdir when rerere enabled","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-01-09T23:29:22Z","receivedAt":"2017-01-09T23:29:30Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Junio C Hamano <gitster@pobox.com> writes:\n>\n>> I wonder if it makes more sense to always move to toplevel upfront\n>> and consistently use path from the toplevel, perhaps like the patch\n>\n> s/the patch/the attached patch/ I meant.\n>\n>> does.  The first hunk is what you wrote but only inside MERGE_RR\n>> block, and the second hunk deals with converting end-user supplied\n>> paths that are relative to the original relative to the top-level.\n>>\n>> The tweaking of $orderfile you have in the first hunk may have to be\n>> tightened mimicking the way how \"eval ... --sq ... ; shift\" is used\n>> in the second hunk to avoid confusion in case orderfile specified by\n>> the end user happens to be the same as a valid revname\n>> (e.g. \"master\").\n>\n> And here is a squash-able patch to illustrate what I mean.\n\nBy the way, I didn't think this through, but how is the orderfile\nthat comes from the configuration file handled when it is not an\nabsolute path?  I think it is _wrong_ to take it as relative to\nwhere the user started the program.  The -O<file> parameter from the\ncommand line, when <file> is not absolute, should be taken as\nrelative to where the user _thinks_ s/he is, but when it comes from\nthe diff.orderfile configuration and it is not absolute, it should\nbe taken as relative to the top of the working tree.  As we always\ncd_to_top with the suggested SQUASH, it means that the orderfile\nthat came from the configuration does not have to be touched, while\nthe orderfile given via -O<file> on the command line needs\nprefixing.\n\n\n\n"},{"id":"309080","messageId":"20170109232941.43637-1-hansenr@google.com","threadId":"44811","inReplyTo":"20170109054238.42599-1-hansenr@google.com","subject":"[PATCH v4 00/14] fix mergetool+rerere+subdir regression","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-09T23:29:27Z","receivedAt":"2017-01-09T23:30:11Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"If rerere is enabled, no pathnames are given, and mergetool is run\nfrom a subdirectory, mergetool always prints \"No files need merging\".\nFix the bug.\n\nThis regression was introduced in\n57937f70a09c12ef484c290865dac4066d207c9c (v2.11.0).\n\nChanges since v3:\n  * Update rev-parse docs to use \"--\" in the --prefix example.\n  * Unconditionally run cd_to_toplevel at the beginning to simplify\n    the control flow.  Thanks Junio!\n  * Test -O<pathname> when there is also a branch named <pathname>.\n\nRichard Hansen (14):\n  .mailmap: Use my personal email address as my canonical\n  rev-parse doc: use \"--\" in the --prefix example\n  t7610: update branch names to match test number\n  t7610: Move setup code to the 'setup' test case.\n  t7610: use test_when_finished for cleanup tasks\n  t7610: don't rely on state from previous test\n  t7610: run 'git reset --hard' after each test to clean up\n  t7610: delete some now-unnecessary 'git reset --hard' lines\n  t7610: always work on a test-specific branch\n  t7610: don't assume the checked-out commit\n  t7610: spell 'git reset --hard' consistently\n  t7610: add test case for rerere+mergetool+subdir bug\n  mergetool: take the \"-O\" out of $orderfile\n  mergetool: fix running in subdir when rerere enabled\n\n .mailmap                        |   2 +\n Documentation/git-rev-parse.txt |   3 +-\n git-mergetool.sh                |  20 ++-\n t/t7610-mergetool.sh            | 281 ++++++++++++++++++++++++----------------\n 4 files changed, 186 insertions(+), 120 deletions(-)\n\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"309081","messageId":"20170109232941.43637-2-hansenr@google.com","threadId":"44811","inReplyTo":"20170109232941.43637-1-hansenr@google.com","subject":"[PATCH v4 01/14] .mailmap: Use my personal email address as my canonical","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-09T23:29:28Z","receivedAt":"2017-01-09T23:30:15Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"When I changed employers my work address changed from rhansen@bbn.com\nto hansenr@google.com.  Rather than map my old work address to my new,\nmap them both to my permanent personal email address.  (I will still\nuse my work address in commits I submit so that my employer gets some\ncredit.)\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n .mailmap | 2 ++\n 1 file changed, 2 insertions(+)\n\ndiff --git a/.mailmap b/.mailmap\nindex 9cc33e925..9c87a3840 100644\n--- a/.mailmap\n+++ b/.mailmap\n@@ -192,6 +192,8 @@ Philippe Bruhat <book@cpan.org>\n Ralf Thielow <ralf.thielow@gmail.com> <ralf.thielow@googlemail.com>\n Ramsay Jones <ramsay@ramsayjones.plus.com> <ramsay@ramsay1.demon.co.uk>\n René Scharfe <l.s.r@web.de> <rene.scharfe@lsrfire.ath.cx>\n+Richard Hansen <rhansen@rhansen.org> <hansenr@google.com>\n+Richard Hansen <rhansen@rhansen.org> <rhansen@bbn.com>\n Robert Fitzsimons <robfitz@273k.net>\n Robert Shearman <robertshearman@gmail.com> <rob@codeweavers.com>\n Robert Zeh <robert.a.zeh@gmail.com>\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"309082","messageId":"20170109232941.43637-3-hansenr@google.com","threadId":"44811","inReplyTo":"20170109232941.43637-1-hansenr@google.com","subject":"[PATCH v4 02/14] rev-parse doc: use \"--\" in the --prefix example","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-09T23:29:29Z","receivedAt":"2017-01-09T23:30:17Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"The \"--\" argument avoids \"ambiguous argument: unknown revision or\npath not in the working tree\" errors when a pathname argument refers\nto a non-existent file.\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n Documentation/git-rev-parse.txt | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt\nindex b6c6326cd..f1190765f 100644\n--- a/Documentation/git-rev-parse.txt\n+++ b/Documentation/git-rev-parse.txt\n@@ -91,7 +91,8 @@ repository.  For example:\n ----\n prefix=$(git rev-parse --show-prefix)\n cd \"$(git rev-parse --show-toplevel)\"\n-eval \"set -- $(git rev-parse --sq --prefix \"$prefix\" \"$@\")\"\n+eval \"set -- $(git rev-parse --sq --prefix \"$prefix\" -- \"$@\")\"\n+shift\n ----\n \n --verify::\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"309083","messageId":"20170109232941.43637-5-hansenr@google.com","threadId":"44811","inReplyTo":"20170109232941.43637-1-hansenr@google.com","subject":"[PATCH v4 04/14] t7610: Move setup code to the 'setup' test case.","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-09T23:29:31Z","receivedAt":"2017-01-09T23:30:19Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"Multiple test cases depend on these hunks, so move them to the 'setup'\ntest case.  This is a step toward making the tests more independent so\nthat if one test fails it doesn't cause subsequent tests to fail.\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n t/t7610-mergetool.sh | 65 ++++++++++++++++++++++++++++------------------------\n 1 file changed, 35 insertions(+), 30 deletions(-)\n\ndiff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh\nindex 14090739f..550838a1c 100755\n--- a/t/t7610-mergetool.sh\n+++ b/t/t7610-mergetool.sh\n@@ -55,6 +55,22 @@ test_expect_success 'setup' '\n \tgit rm file12 &&\n \tgit commit -m \"branch1 changes\" &&\n \n+\tgit checkout -b delete-base branch1 &&\n+\tmkdir -p a/a &&\n+\t(echo one; echo two; echo 3; echo 4) >a/a/file.txt &&\n+\tgit add a/a/file.txt &&\n+\tgit commit -m\"base file\" &&\n+\tgit checkout -b move-to-b delete-base &&\n+\tmkdir -p b/b &&\n+\tgit mv a/a/file.txt b/b/file.txt &&\n+\t(echo one; echo two; echo 4) >b/b/file.txt &&\n+\tgit commit -a -m\"move to b\" &&\n+\tgit checkout -b move-to-c delete-base &&\n+\tmkdir -p c/c &&\n+\tgit mv a/a/file.txt c/c/file.txt &&\n+\t(echo one; echo two; echo 3) >c/c/file.txt &&\n+\tgit commit -a -m\"move to c\" &&\n+\n \tgit checkout -b stash1 master &&\n \techo stash1 change file11 >file11 &&\n \tgit add file11 &&\n@@ -86,6 +102,23 @@ test_expect_success 'setup' '\n \tgit rm file11 &&\n \tgit commit -m \"master updates\" &&\n \n+\tgit clean -fdx &&\n+\tgit checkout -b order-file-start master &&\n+\techo start >a &&\n+\techo start >b &&\n+\tgit add a b &&\n+\tgit commit -m start &&\n+\tgit checkout -b order-file-side1 order-file-start &&\n+\techo side1 >a &&\n+\techo side1 >b &&\n+\tgit add a b &&\n+\tgit commit -m side1 &&\n+\tgit checkout -b order-file-side2 order-file-start &&\n+\techo side2 >a &&\n+\techo side2 >b &&\n+\tgit add a b &&\n+\tgit commit -m side2 &&\n+\n \tgit config merge.tool mytool &&\n \tgit config mergetool.mytool.cmd \"cat \\\"\\$REMOTE\\\" >\\\"\\$MERGED\\\"\" &&\n \tgit config mergetool.mytool.trustExitCode true &&\n@@ -244,21 +277,7 @@ test_expect_success 'mergetool takes partial path' '\n '\n \n test_expect_success 'mergetool delete/delete conflict' '\n-\tgit checkout -b delete-base branch1 &&\n-\tmkdir -p a/a &&\n-\t(echo one; echo two; echo 3; echo 4) >a/a/file.txt &&\n-\tgit add a/a/file.txt &&\n-\tgit commit -m\"base file\" &&\n-\tgit checkout -b move-to-b delete-base &&\n-\tmkdir -p b/b &&\n-\tgit mv a/a/file.txt b/b/file.txt &&\n-\t(echo one; echo two; echo 4) >b/b/file.txt &&\n-\tgit commit -a -m\"move to b\" &&\n-\tgit checkout -b move-to-c delete-base &&\n-\tmkdir -p c/c &&\n-\tgit mv a/a/file.txt c/c/file.txt &&\n-\t(echo one; echo two; echo 3) >c/c/file.txt &&\n-\tgit commit -a -m\"move to c\" &&\n+\tgit checkout move-to-c &&\n \ttest_must_fail git merge move-to-b &&\n \techo d | git mergetool a/a/file.txt &&\n \t! test -f a/a/file.txt &&\n@@ -607,26 +626,12 @@ test_expect_success MKTEMP 'temporary filenames are used with mergetool.writeToT\n '\n \n test_expect_success 'diff.orderFile configuration is honored' '\n+\tgit checkout order-file-side2 &&\n \ttest_config diff.orderFile order-file &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n \ttest_config mergetool.myecho.trustExitCode true &&\n \techo b >order-file &&\n \techo a >>order-file &&\n-\tgit checkout -b order-file-start master &&\n-\techo start >a &&\n-\techo start >b &&\n-\tgit add a b &&\n-\tgit commit -m start &&\n-\tgit checkout -b order-file-side1 order-file-start &&\n-\techo side1 >a &&\n-\techo side1 >b &&\n-\tgit add a b &&\n-\tgit commit -m side1 &&\n-\tgit checkout -b order-file-side2 order-file-start &&\n-\techo side2 >a &&\n-\techo side2 >b &&\n-\tgit add a b &&\n-\tgit commit -m side2 &&\n \ttest_must_fail git merge order-file-side1 &&\n \tcat >expect <<-\\EOF &&\n \t\tMerging:\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"309084","messageId":"20170109232941.43637-6-hansenr@google.com","threadId":"44811","inReplyTo":"20170109232941.43637-1-hansenr@google.com","subject":"[PATCH v4 05/14] t7610: use test_when_finished for cleanup tasks","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-09T23:29:32Z","receivedAt":"2017-01-09T23:30:24Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"This is a step toward making the tests more independent so that if one\ntest fails it doesn't cause subsequent tests to fail.\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n t/t7610-mergetool.sh | 71 +++++++++++++++++++++++++++-------------------------\n 1 file changed, 37 insertions(+), 34 deletions(-)\n\ndiff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh\nindex 550838a1c..f62ceffdc 100755\n--- a/t/t7610-mergetool.sh\n+++ b/t/t7610-mergetool.sh\n@@ -145,6 +145,11 @@ test_expect_success 'custom mergetool' '\n '\n \n test_expect_success 'mergetool crlf' '\n+\ttest_when_finished \"git reset --hard\" &&\n+\t# This test_config line must go after the above reset line so that\n+\t# core.autocrlf is unconfigured before reset runs.  (The\n+\t# test_config command uses test_when_finished internally and\n+\t# test_when_finished is LIFO.)\n \ttest_config core.autocrlf true &&\n \tgit checkout -b test$test_count branch1 &&\n \ttest_must_fail git merge master >/dev/null 2>&1 &&\n@@ -161,9 +166,7 @@ test_expect_success 'mergetool crlf' '\n \ttest \"$(printf x | cat subdir/file3 -)\" = \"$(printf \"master new sub\\r\\nx\")\" &&\n \tgit submodule update -N &&\n \ttest \"$(cat submod/bar)\" = \"master submodule\" &&\n-\tgit commit -m \"branch1 resolved with mergetool - autocrlf\" &&\n-\ttest_config core.autocrlf false &&\n-\tgit reset --hard\n+\tgit commit -m \"branch1 resolved with mergetool - autocrlf\"\n '\n \n test_expect_success 'mergetool in subdir' '\n@@ -194,6 +197,7 @@ test_expect_success 'mergetool on file in parent dir' '\n '\n \n test_expect_success 'mergetool skips autoresolved' '\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \ttest_must_fail git merge master &&\n@@ -202,8 +206,7 @@ test_expect_success 'mergetool skips autoresolved' '\n \t( yes \"d\" | git mergetool file12 >/dev/null 2>&1 ) &&\n \t( yes \"l\" | git mergetool submod >/dev/null 2>&1 ) &&\n \toutput=\"$(git mergetool --no-prompt)\" &&\n-\ttest \"$output\" = \"No files need merging\" &&\n-\tgit reset --hard\n+\ttest \"$output\" = \"No files need merging\"\n '\n \n test_expect_success 'mergetool merges all from subdir' '\n@@ -223,6 +226,7 @@ test_expect_success 'mergetool merges all from subdir' '\n '\n \n test_expect_success 'mergetool skips resolved paths when rerere is active' '\n+\ttest_when_finished \"git reset --hard\" &&\n \ttest_config rerere.enabled true &&\n \trm -rf .git/rr-cache &&\n \tgit checkout -b test$test_count branch1 &&\n@@ -232,8 +236,7 @@ test_expect_success 'mergetool skips resolved paths when rerere is active' '\n \t( yes \"d\" \"d\" | git mergetool --no-prompt >/dev/null 2>&1 ) &&\n \tgit submodule update -N &&\n \toutput=\"$(yes \"n\" | git mergetool --no-prompt)\" &&\n-\ttest \"$output\" = \"No files need merging\" &&\n-\tgit reset --hard\n+\ttest \"$output\" = \"No files need merging\"\n '\n \n test_expect_success 'conflicted stash sets up rerere'  '\n@@ -264,6 +267,7 @@ test_expect_success 'conflicted stash sets up rerere'  '\n '\n \n test_expect_success 'mergetool takes partial path' '\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit reset --hard &&\n \ttest_config rerere.enabled false &&\n \tgit checkout -b test$test_count branch1 &&\n@@ -272,11 +276,11 @@ test_expect_success 'mergetool takes partial path' '\n \n \t( yes \"\" | git mergetool subdir ) &&\n \n-\ttest \"$(cat subdir/file3)\" = \"master new sub\" &&\n-\tgit reset --hard\n+\ttest \"$(cat subdir/file3)\" = \"master new sub\"\n '\n \n test_expect_success 'mergetool delete/delete conflict' '\n+\ttest_when_finished \"git reset --hard HEAD\" &&\n \tgit checkout move-to-c &&\n \ttest_must_fail git merge move-to-b &&\n \techo d | git mergetool a/a/file.txt &&\n@@ -288,29 +292,30 @@ test_expect_success 'mergetool delete/delete conflict' '\n \tgit reset --hard HEAD &&\n \ttest_must_fail git merge move-to-b &&\n \t! echo a | git mergetool a/a/file.txt &&\n-\t! test -f a/a/file.txt &&\n-\tgit reset --hard HEAD\n+\t! test -f a/a/file.txt\n '\n \n test_expect_success 'mergetool produces no errors when keepBackup is used' '\n+\ttest_when_finished \"git reset --hard HEAD\" &&\n \ttest_config mergetool.keepBackup true &&\n \ttest_must_fail git merge move-to-b &&\n \t: >expect &&\n \techo d | git mergetool a/a/file.txt 2>actual &&\n \ttest_cmp expect actual &&\n-\t! test -d a &&\n-\tgit reset --hard HEAD\n+\t! test -d a\n '\n \n test_expect_success 'mergetool honors tempfile config for deleted files' '\n+\ttest_when_finished \"git reset --hard HEAD\" &&\n \ttest_config mergetool.keepTemporaries false &&\n \ttest_must_fail git merge move-to-b &&\n \techo d | git mergetool a/a/file.txt &&\n-\t! test -d a &&\n-\tgit reset --hard HEAD\n+\t! test -d a\n '\n \n test_expect_success 'mergetool keeps tempfiles when aborting delete/delete' '\n+\ttest_when_finished \"git reset --hard HEAD\" &&\n+\ttest_when_finished \"git clean -fdx\" &&\n \ttest_config mergetool.keepTemporaries true &&\n \ttest_must_fail git merge move-to-b &&\n \t! (echo a; echo n) | git mergetool a/a/file.txt &&\n@@ -321,12 +326,11 @@ test_expect_success 'mergetool keeps tempfiles when aborting delete/delete' '\n \tfile_REMOTE_.txt\n \tEOF\n \tls -1 a/a | sed -e \"s/[0-9]*//g\" >actual &&\n-\ttest_cmp expect actual &&\n-\tgit clean -fdx &&\n-\tgit reset --hard HEAD\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'deleted vs modified submodule' '\n+\ttest_when_finished \"git reset --hard HEAD\" &&\n \tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \tmv submod submod-movedaside &&\n@@ -391,8 +395,7 @@ test_expect_success 'deleted vs modified submodule' '\n \ttest \"$(cat submod/bar)\" = \"master submodule\" &&\n \toutput=\"$(git mergetool --no-prompt)\" &&\n \ttest \"$output\" = \"No files need merging\" &&\n-\tgit commit -m \"Merge resolved by keeping module\" &&\n-\tgit reset --hard HEAD\n+\tgit commit -m \"Merge resolved by keeping module\"\n '\n \n test_expect_success 'file vs modified submodule' '\n@@ -479,6 +482,7 @@ test_expect_success 'submodule in subdirectory' '\n \t\tgit commit -m \"add initial versions\"\n \t\t)\n \t) &&\n+\ttest_when_finished \"rm -rf subdir/subdir_module\" &&\n \tgit submodule add git://example.com/subsubmodule subdir/subdir_module &&\n \tgit add subdir/subdir_module &&\n \tgit commit -m \"add submodule in subdirectory\" &&\n@@ -523,8 +527,7 @@ test_expect_success 'submodule in subdirectory' '\n \ttest \"$(cat subdir/subdir_module/file15)\" = \"test$test_count.b\" &&\n \tgit submodule update -N &&\n \ttest \"$(cat subdir/subdir_module/file15)\" = \"test$test_count.a\" &&\n-\tgit commit -m \"branch1 resolved with mergetool\" &&\n-\trm -rf subdir/subdir_module\n+\tgit commit -m \"branch1 resolved with mergetool\"\n '\n \n test_expect_success 'directory vs modified submodule' '\n@@ -578,34 +581,34 @@ test_expect_success 'directory vs modified submodule' '\n '\n \n test_expect_success 'file with no base' '\n+\ttest_when_finished \"git reset --hard master >/dev/null 2>&1\" &&\n \tgit checkout -b test$test_count branch1 &&\n \ttest_must_fail git merge master &&\n \tgit mergetool --no-prompt --tool mybase -- both &&\n \t>expected &&\n-\ttest_cmp both expected &&\n-\tgit reset --hard master >/dev/null 2>&1\n+\ttest_cmp both expected\n '\n \n test_expect_success 'custom commands override built-ins' '\n+\ttest_when_finished \"git reset --hard master >/dev/null 2>&1\" &&\n \tgit checkout -b test$test_count branch1 &&\n \ttest_config mergetool.defaults.cmd \"cat \\\"\\$REMOTE\\\" >\\\"\\$MERGED\\\"\" &&\n \ttest_config mergetool.defaults.trustExitCode true &&\n \ttest_must_fail git merge master &&\n \tgit mergetool --no-prompt --tool defaults -- both &&\n \techo master both added >expected &&\n-\ttest_cmp both expected &&\n-\tgit reset --hard master >/dev/null 2>&1\n+\ttest_cmp both expected\n '\n \n test_expect_success 'filenames seen by tools start with ./' '\n+\ttest_when_finished \"git reset --hard master >/dev/null 2>&1\" &&\n \tgit checkout -b test$test_count branch1 &&\n \ttest_config mergetool.writeToTemp false &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n \ttest_config mergetool.myecho.trustExitCode true &&\n \ttest_must_fail git merge master &&\n \tgit mergetool --no-prompt --tool myecho -- both >actual &&\n-\tgrep ^\\./both_LOCAL_ actual >/dev/null &&\n-\tgit reset --hard master >/dev/null 2>&1\n+\tgrep ^\\./both_LOCAL_ actual >/dev/null\n '\n \n test_lazy_prereq MKTEMP '\n@@ -614,6 +617,7 @@ test_lazy_prereq MKTEMP '\n '\n \n test_expect_success MKTEMP 'temporary filenames are used with mergetool.writeToTemp' '\n+\ttest_when_finished \"git reset --hard master >/dev/null 2>&1\" &&\n \tgit checkout -b test$test_count branch1 &&\n \ttest_config mergetool.writeToTemp true &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n@@ -621,11 +625,11 @@ test_expect_success MKTEMP 'temporary filenames are used with mergetool.writeToT\n \ttest_must_fail git merge master &&\n \tgit mergetool --no-prompt --tool myecho -- both >actual &&\n \ttest_must_fail grep ^\\./both_LOCAL_ actual >/dev/null &&\n-\tgrep /both_LOCAL_ actual >/dev/null &&\n-\tgit reset --hard master >/dev/null 2>&1\n+\tgrep /both_LOCAL_ actual >/dev/null\n '\n \n test_expect_success 'diff.orderFile configuration is honored' '\n+\ttest_when_finished \"git reset --hard >/dev/null\" &&\n \tgit checkout order-file-side2 &&\n \ttest_config diff.orderFile order-file &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n@@ -640,10 +644,10 @@ test_expect_success 'diff.orderFile configuration is honored' '\n \tEOF\n \tgit mergetool --no-prompt --tool myecho >output &&\n \tgit grep --no-index -h -A2 Merging: output >actual &&\n-\ttest_cmp expect actual &&\n-\tgit reset --hard >/dev/null\n+\ttest_cmp expect actual\n '\n test_expect_success 'mergetool -Oorder-file is honored' '\n+\ttest_when_finished \"git reset --hard >/dev/null 2>&1\" &&\n \ttest_config diff.orderFile order-file &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n \ttest_config mergetool.myecho.trustExitCode true &&\n@@ -667,8 +671,7 @@ test_expect_success 'mergetool -Oorder-file is honored' '\n \tEOF\n \tgit mergetool -Oorder-file --no-prompt --tool myecho >output &&\n \tgit grep --no-index -h -A2 Merging: output >actual &&\n-\ttest_cmp expect actual &&\n-\tgit reset --hard >/dev/null 2>&1\n+\ttest_cmp expect actual\n '\n \n test_done\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"309085","messageId":"20170109232941.43637-9-hansenr@google.com","threadId":"44811","inReplyTo":"20170109232941.43637-1-hansenr@google.com","subject":"[PATCH v4 08/14] t7610: delete some now-unnecessary 'git reset --hard' lines","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-09T23:29:35Z","receivedAt":"2017-01-09T23:30:27Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"Tests now always run 'git reset --hard' at the end (even if they\nfail), so it's no longer necessary to run 'git reset --hard' at the\nbeginning of a test.\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n t/t7610-mergetool.sh | 2 --\n 1 file changed, 2 deletions(-)\n\ndiff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh\nindex 55587504e..7d5e1df88 100755\n--- a/t/t7610-mergetool.sh\n+++ b/t/t7610-mergetool.sh\n@@ -184,7 +184,6 @@ test_expect_success 'mergetool in subdir' '\n \n test_expect_success 'mergetool on file in parent dir' '\n \ttest_when_finished \"git reset --hard\" &&\n-\tgit reset --hard &&\n \tgit submodule update -N &&\n \t(\n \t\tcd subdir &&\n@@ -277,7 +276,6 @@ test_expect_success 'conflicted stash sets up rerere'  '\n \n test_expect_success 'mergetool takes partial path' '\n \ttest_when_finished \"git reset --hard\" &&\n-\tgit reset --hard &&\n \ttest_config rerere.enabled false &&\n \tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"309086","messageId":"20170109232941.43637-11-hansenr@google.com","threadId":"44811","inReplyTo":"20170109232941.43637-1-hansenr@google.com","subject":"[PATCH v4 10/14] t7610: don't assume the checked-out commit","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-09T23:29:37Z","receivedAt":"2017-01-09T23:30:30Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"Always check out the required commit at the beginning of the test so\nthat a failure in a previous test does not cause the test to work off\nof the wrong commit.\n\nThis is a step toward making the tests more independent so that if one\ntest fails it doesn't cause subsequent tests to fail.\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n t/t7610-mergetool.sh | 12 ++++++------\n 1 file changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh\nindex efcf5c3f1..54164a320 100755\n--- a/t/t7610-mergetool.sh\n+++ b/t/t7610-mergetool.sh\n@@ -184,7 +184,7 @@ test_expect_success 'mergetool in subdir' '\n \n test_expect_success 'mergetool on file in parent dir' '\n \ttest_when_finished \"git reset --hard\" &&\n-\tgit checkout -b test$test_count &&\n+\tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \t(\n \t\tcd subdir &&\n@@ -218,7 +218,7 @@ test_expect_success 'mergetool skips autoresolved' '\n \n test_expect_success 'mergetool merges all from subdir' '\n \ttest_when_finished \"git reset --hard\" &&\n-\tgit checkout -b test$test_count &&\n+\tgit checkout -b test$test_count branch1 &&\n \ttest_config rerere.enabled false &&\n \t(\n \t\tcd subdir &&\n@@ -306,7 +306,7 @@ test_expect_success 'mergetool delete/delete conflict' '\n \n test_expect_success 'mergetool produces no errors when keepBackup is used' '\n \ttest_when_finished \"git reset --hard HEAD\" &&\n-\tgit checkout -b test$test_count &&\n+\tgit checkout -b test$test_count move-to-c &&\n \ttest_config mergetool.keepBackup true &&\n \ttest_must_fail git merge move-to-b &&\n \t: >expect &&\n@@ -317,7 +317,7 @@ test_expect_success 'mergetool produces no errors when keepBackup is used' '\n \n test_expect_success 'mergetool honors tempfile config for deleted files' '\n \ttest_when_finished \"git reset --hard HEAD\" &&\n-\tgit checkout -b test$test_count &&\n+\tgit checkout -b test$test_count move-to-c &&\n \ttest_config mergetool.keepTemporaries false &&\n \ttest_must_fail git merge move-to-b &&\n \techo d | git mergetool a/a/file.txt &&\n@@ -327,7 +327,7 @@ test_expect_success 'mergetool honors tempfile config for deleted files' '\n test_expect_success 'mergetool keeps tempfiles when aborting delete/delete' '\n \ttest_when_finished \"git reset --hard HEAD\" &&\n \ttest_when_finished \"git clean -fdx\" &&\n-\tgit checkout -b test$test_count &&\n+\tgit checkout -b test$test_count move-to-c &&\n \ttest_config mergetool.keepTemporaries true &&\n \ttest_must_fail git merge move-to-b &&\n \t! (echo a; echo n) | git mergetool a/a/file.txt &&\n@@ -663,7 +663,7 @@ test_expect_success 'diff.orderFile configuration is honored' '\n '\n test_expect_success 'mergetool -Oorder-file is honored' '\n \ttest_when_finished \"git reset --hard >/dev/null 2>&1\" &&\n-\tgit checkout -b test$test_count &&\n+\tgit checkout -b test$test_count order-file-side2 &&\n \ttest_config diff.orderFile order-file &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n \ttest_config mergetool.myecho.trustExitCode true &&\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"309087","messageId":"20170109232941.43637-14-hansenr@google.com","threadId":"44811","inReplyTo":"20170109232941.43637-1-hansenr@google.com","subject":"[PATCH v4 13/14] mergetool: take the \"-O\" out of $orderfile","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-09T23:29:40Z","receivedAt":"2017-01-09T23:30:32Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"This will make it easier for a future commit to convert a relative\norderfile pathname to either absolute or relative to the top-level\ndirectory.  It also improves code readability.\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n git-mergetool.sh | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/git-mergetool.sh b/git-mergetool.sh\nindex e52b4e4f2..b506896dc 100755\n--- a/git-mergetool.sh\n+++ b/git-mergetool.sh\n@@ -421,7 +421,7 @@ main () {\n \t\t\tprompt=true\n \t\t\t;;\n \t\t-O*)\n-\t\t\torderfile=\"$1\"\n+\t\t\torderfile=\"${1#-O}\"\n \t\t\t;;\n \t\t--)\n \t\t\tshift\n@@ -465,7 +465,7 @@ main () {\n \n \tfiles=$(git -c core.quotePath=false \\\n \t\tdiff --name-only --diff-filter=U \\\n-\t\t${orderfile:+\"$orderfile\"} -- \"$@\")\n+\t\t${orderfile:+\"-O$orderfile\"} -- \"$@\")\n \n \tcd_to_toplevel\n \n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"309088","messageId":"20170109232941.43637-12-hansenr@google.com","threadId":"44811","inReplyTo":"20170109232941.43637-1-hansenr@google.com","subject":"[PATCH v4 11/14] t7610: spell 'git reset --hard' consistently","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-09T23:29:38Z","receivedAt":"2017-01-09T23:30:35Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"Signed-off-by: Richard Hansen <hansenr@google.com>\n---\n t/t7610-mergetool.sh | 37 +++++++++++++++++++------------------\n 1 file changed, 19 insertions(+), 18 deletions(-)\n\ndiff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh\nindex 54164a320..c031ecd9e 100755\n--- a/t/t7610-mergetool.sh\n+++ b/t/t7610-mergetool.sh\n@@ -289,23 +289,23 @@ test_expect_success 'mergetool takes partial path' '\n '\n \n test_expect_success 'mergetool delete/delete conflict' '\n-\ttest_when_finished \"git reset --hard HEAD\" &&\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count move-to-c &&\n \ttest_must_fail git merge move-to-b &&\n \techo d | git mergetool a/a/file.txt &&\n \t! test -f a/a/file.txt &&\n-\tgit reset --hard HEAD &&\n+\tgit reset --hard &&\n \ttest_must_fail git merge move-to-b &&\n \techo m | git mergetool a/a/file.txt &&\n \ttest -f b/b/file.txt &&\n-\tgit reset --hard HEAD &&\n+\tgit reset --hard &&\n \ttest_must_fail git merge move-to-b &&\n \t! echo a | git mergetool a/a/file.txt &&\n \t! test -f a/a/file.txt\n '\n \n test_expect_success 'mergetool produces no errors when keepBackup is used' '\n-\ttest_when_finished \"git reset --hard HEAD\" &&\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count move-to-c &&\n \ttest_config mergetool.keepBackup true &&\n \ttest_must_fail git merge move-to-b &&\n@@ -316,7 +316,7 @@ test_expect_success 'mergetool produces no errors when keepBackup is used' '\n '\n \n test_expect_success 'mergetool honors tempfile config for deleted files' '\n-\ttest_when_finished \"git reset --hard HEAD\" &&\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count move-to-c &&\n \ttest_config mergetool.keepTemporaries false &&\n \ttest_must_fail git merge move-to-b &&\n@@ -325,7 +325,7 @@ test_expect_success 'mergetool honors tempfile config for deleted files' '\n '\n \n test_expect_success 'mergetool keeps tempfiles when aborting delete/delete' '\n-\ttest_when_finished \"git reset --hard HEAD\" &&\n+\ttest_when_finished \"git reset --hard\" &&\n \ttest_when_finished \"git clean -fdx\" &&\n \tgit checkout -b test$test_count move-to-c &&\n \ttest_config mergetool.keepTemporaries true &&\n@@ -342,7 +342,7 @@ test_expect_success 'mergetool keeps tempfiles when aborting delete/delete' '\n '\n \n test_expect_success 'deleted vs modified submodule' '\n-\ttest_when_finished \"git reset --hard HEAD\" &&\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \tmv submod submod-movedaside &&\n@@ -560,7 +560,7 @@ test_expect_success 'directory vs modified submodule' '\n \ttest \"$(cat submod/file16)\" = \"not a submodule\" &&\n \trm -rf submod.orig &&\n \n-\tgit reset --hard >/dev/null 2>&1 &&\n+\tgit reset --hard &&\n \ttest_must_fail git merge master &&\n \ttest -n \"$(git ls-files -u)\" &&\n \ttest ! -e submod.orig &&\n@@ -572,7 +572,8 @@ test_expect_success 'directory vs modified submodule' '\n \t( cd submod && git clean -f && git reset --hard ) &&\n \tgit submodule update -N &&\n \ttest \"$(cat submod/bar)\" = \"master submodule\" &&\n-\tgit reset --hard >/dev/null 2>&1 && rm -rf submod-movedaside &&\n+\tgit reset --hard &&\n+\trm -rf submod-movedaside &&\n \n \tgit checkout -b test$test_count.c master &&\n \tgit submodule update -N &&\n@@ -582,7 +583,7 @@ test_expect_success 'directory vs modified submodule' '\n \tgit submodule update -N &&\n \ttest \"$(cat submod/bar)\" = \"master submodule\" &&\n \n-\tgit reset --hard >/dev/null 2>&1 &&\n+\tgit reset --hard &&\n \tgit submodule update -N &&\n \ttest_must_fail git merge test$test_count &&\n \ttest -n \"$(git ls-files -u)\" &&\n@@ -590,13 +591,13 @@ test_expect_success 'directory vs modified submodule' '\n \t( yes \"r\" | git mergetool submod ) &&\n \ttest \"$(cat submod/file16)\" = \"not a submodule\" &&\n \n-\tgit reset --hard master >/dev/null 2>&1 &&\n+\tgit reset --hard master &&\n \t( cd submod && git clean -f && git reset --hard ) &&\n \tgit submodule update -N\n '\n \n test_expect_success 'file with no base' '\n-\ttest_when_finished \"git reset --hard master >/dev/null 2>&1\" &&\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \ttest_must_fail git merge master &&\n \tgit mergetool --no-prompt --tool mybase -- both &&\n@@ -605,7 +606,7 @@ test_expect_success 'file with no base' '\n '\n \n test_expect_success 'custom commands override built-ins' '\n-\ttest_when_finished \"git reset --hard master >/dev/null 2>&1\" &&\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \ttest_config mergetool.defaults.cmd \"cat \\\"\\$REMOTE\\\" >\\\"\\$MERGED\\\"\" &&\n \ttest_config mergetool.defaults.trustExitCode true &&\n@@ -616,7 +617,7 @@ test_expect_success 'custom commands override built-ins' '\n '\n \n test_expect_success 'filenames seen by tools start with ./' '\n-\ttest_when_finished \"git reset --hard master >/dev/null 2>&1\" &&\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \ttest_config mergetool.writeToTemp false &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n@@ -632,7 +633,7 @@ test_lazy_prereq MKTEMP '\n '\n \n test_expect_success MKTEMP 'temporary filenames are used with mergetool.writeToTemp' '\n-\ttest_when_finished \"git reset --hard master >/dev/null 2>&1\" &&\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \ttest_config mergetool.writeToTemp true &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n@@ -644,7 +645,7 @@ test_expect_success MKTEMP 'temporary filenames are used with mergetool.writeToT\n '\n \n test_expect_success 'diff.orderFile configuration is honored' '\n-\ttest_when_finished \"git reset --hard >/dev/null\" &&\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count order-file-side2 &&\n \ttest_config diff.orderFile order-file &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n@@ -662,7 +663,7 @@ test_expect_success 'diff.orderFile configuration is honored' '\n \ttest_cmp expect actual\n '\n test_expect_success 'mergetool -Oorder-file is honored' '\n-\ttest_when_finished \"git reset --hard >/dev/null 2>&1\" &&\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count order-file-side2 &&\n \ttest_config diff.orderFile order-file &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n@@ -678,7 +679,7 @@ test_expect_success 'mergetool -Oorder-file is honored' '\n \tgit mergetool -O/dev/null --no-prompt --tool myecho >output &&\n \tgit grep --no-index -h -A2 Merging: output >actual &&\n \ttest_cmp expect actual &&\n-\tgit reset --hard >/dev/null 2>&1 &&\n+\tgit reset --hard &&\n \n \tgit config --unset diff.orderFile &&\n \ttest_must_fail git merge order-file-side1 &&\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"309089","messageId":"20170109232941.43637-15-hansenr@google.com","threadId":"44811","inReplyTo":"20170109232941.43637-1-hansenr@google.com","subject":"[PATCH v4 14/14] mergetool: fix running in subdir when rerere enabled","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-09T23:29:41Z","receivedAt":"2017-01-09T23:30:37Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"The pathnames output by the 'git rerere remaining' command are\nrelative to the top-level directory but the 'git diff --name-only'\ncommand expects its pathname arguments to be relative to the current\nworking directory.  Run cd_to_toplevel before running 'git diff\n--name-only' and adjust any relative pathnames so that 'git mergetool'\ndoes not fail when run from a subdirectory with rerere enabled.\n\nThis fixes a regression introduced in\n57937f70a09c12ef484c290865dac4066d207c9c (v2.11.0).\n\nBased-on-patch-by: Junio C Hamano <gitster@pobox.com>\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n git-mergetool.sh     | 16 ++++++++++++++--\n t/t7610-mergetool.sh |  7 ++++++-\n 2 files changed, 20 insertions(+), 3 deletions(-)\n\ndiff --git a/git-mergetool.sh b/git-mergetool.sh\nindex b506896dc..cba6bbd05 100755\n--- a/git-mergetool.sh\n+++ b/git-mergetool.sh\n@@ -454,6 +454,15 @@ main () {\n \tmerge_keep_backup=\"$(git config --bool mergetool.keepBackup || echo true)\"\n \tmerge_keep_temporaries=\"$(git config --bool mergetool.keepTemporaries || echo false)\"\n \n+\tprefix=$(git rev-parse --show-prefix) || exit 1\n+\tcd_to_toplevel\n+\n+\tif test -n \"$orderfile\"\n+\tthen\n+\t\torderfile=$(git rev-parse --prefix \"$prefix\" -- \"$orderfile\") || exit 1\n+\t\torderfile=$(printf %s\\\\n \"$orderfile\" | sed -e 1d)\n+\tfi\n+\n \tif test $# -eq 0 && test -e \"$GIT_DIR/MERGE_RR\"\n \tthen\n \t\tset -- $(git rerere remaining)\n@@ -461,14 +470,17 @@ main () {\n \t\tthen\n \t\t\tprint_noop_and_exit\n \t\tfi\n+\telif test $# -ge 0\n+\tthen\n+\t\tfiles_quoted=$(git rev-parse --sq --prefix \"$prefix\" -- \"$@\") || exit 1\n+\t\teval \"set -- $files_quoted\"\n+\t\tshift\n \tfi\n \n \tfiles=$(git -c core.quotePath=false \\\n \t\tdiff --name-only --diff-filter=U \\\n \t\t${orderfile:+\"-O$orderfile\"} -- \"$@\")\n \n-\tcd_to_toplevel\n-\n \tif test -z \"$files\"\n \tthen\n \t\tprint_noop_and_exit\ndiff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh\nindex b36fde1c0..820fc8597 100755\n--- a/t/t7610-mergetool.sh\n+++ b/t/t7610-mergetool.sh\n@@ -234,7 +234,7 @@ test_expect_success 'mergetool merges all from subdir (rerere disabled)' '\n \t)\n '\n \n-test_expect_failure 'mergetool merges all from subdir (rerere enabled)' '\n+test_expect_success 'mergetool merges all from subdir (rerere enabled)' '\n \ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \ttest_config rerere.enabled true &&\n@@ -677,6 +677,11 @@ test_expect_success 'diff.orderFile configuration is honored' '\n \t\tb\n \t\ta\n \tEOF\n+\n+\t# make sure \"order-file\" that is ambiguous between\n+\t# rev and path is understood correctly.\n+\tgit branch order-file HEAD &&\n+\n \tgit mergetool --no-prompt --tool myecho >output &&\n \tgit grep --no-index -h -A2 Merging: output >actual &&\n \ttest_cmp expect actual\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"309090","messageId":"20170109232941.43637-13-hansenr@google.com","threadId":"44811","inReplyTo":"20170109232941.43637-1-hansenr@google.com","subject":"[PATCH v4 12/14] t7610: add test case for rerere+mergetool+subdir bug","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-09T23:29:39Z","receivedAt":"2017-01-09T23:30:39Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"If rerere is enabled and mergetool is run from a subdirectory,\nmergetool always prints \"No files need merging\".  Add an expected\nfailure test case for this situation.\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n t/t7610-mergetool.sh | 21 ++++++++++++++++++++-\n 1 file changed, 20 insertions(+), 1 deletion(-)\n\ndiff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh\nindex c031ecd9e..b36fde1c0 100755\n--- a/t/t7610-mergetool.sh\n+++ b/t/t7610-mergetool.sh\n@@ -216,7 +216,7 @@ test_expect_success 'mergetool skips autoresolved' '\n \ttest \"$output\" = \"No files need merging\"\n '\n \n-test_expect_success 'mergetool merges all from subdir' '\n+test_expect_success 'mergetool merges all from subdir (rerere disabled)' '\n \ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \ttest_config rerere.enabled false &&\n@@ -234,6 +234,25 @@ test_expect_success 'mergetool merges all from subdir' '\n \t)\n '\n \n+test_expect_failure 'mergetool merges all from subdir (rerere enabled)' '\n+\ttest_when_finished \"git reset --hard\" &&\n+\tgit checkout -b test$test_count branch1 &&\n+\ttest_config rerere.enabled true &&\n+\trm -rf .git/rr-cache &&\n+\t(\n+\t\tcd subdir &&\n+\t\ttest_must_fail git merge master &&\n+\t\t( yes \"r\" | git mergetool ../submod ) &&\n+\t\t( yes \"d\" \"d\" | git mergetool --no-prompt ) &&\n+\t\ttest \"$(cat ../file1)\" = \"master updated\" &&\n+\t\ttest \"$(cat ../file2)\" = \"master new\" &&\n+\t\ttest \"$(cat file3)\" = \"master new sub\" &&\n+\t\t( cd .. && git submodule update -N ) &&\n+\t\ttest \"$(cat ../submod/bar)\" = \"master submodule\" &&\n+\t\tgit commit -m \"branch2 resolved by mergetool from subdir\"\n+\t)\n+'\n+\n test_expect_success 'mergetool skips resolved paths when rerere is active' '\n \ttest_when_finished \"git reset --hard\" &&\n \ttest_config rerere.enabled true &&\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"309091","messageId":"20170109232941.43637-10-hansenr@google.com","threadId":"44811","inReplyTo":"20170109232941.43637-1-hansenr@google.com","subject":"[PATCH v4 09/14] t7610: always work on a test-specific branch","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-09T23:29:36Z","receivedAt":"2017-01-09T23:30:42Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"Create and use a test-specific branch when the test might create a\ncommit.  This is not always necessary for correctness, but it improves\ndebuggability by ensuring a commit created by test #N shows up on the\ntestN branch, not the branch for test #N-1.\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n t/t7610-mergetool.sh | 10 ++++++++--\n 1 file changed, 8 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh\nindex 7d5e1df88..efcf5c3f1 100755\n--- a/t/t7610-mergetool.sh\n+++ b/t/t7610-mergetool.sh\n@@ -184,6 +184,7 @@ test_expect_success 'mergetool in subdir' '\n \n test_expect_success 'mergetool on file in parent dir' '\n \ttest_when_finished \"git reset --hard\" &&\n+\tgit checkout -b test$test_count &&\n \tgit submodule update -N &&\n \t(\n \t\tcd subdir &&\n@@ -217,6 +218,7 @@ test_expect_success 'mergetool skips autoresolved' '\n \n test_expect_success 'mergetool merges all from subdir' '\n \ttest_when_finished \"git reset --hard\" &&\n+\tgit checkout -b test$test_count &&\n \ttest_config rerere.enabled false &&\n \t(\n \t\tcd subdir &&\n@@ -288,7 +290,7 @@ test_expect_success 'mergetool takes partial path' '\n \n test_expect_success 'mergetool delete/delete conflict' '\n \ttest_when_finished \"git reset --hard HEAD\" &&\n-\tgit checkout move-to-c &&\n+\tgit checkout -b test$test_count move-to-c &&\n \ttest_must_fail git merge move-to-b &&\n \techo d | git mergetool a/a/file.txt &&\n \t! test -f a/a/file.txt &&\n@@ -304,6 +306,7 @@ test_expect_success 'mergetool delete/delete conflict' '\n \n test_expect_success 'mergetool produces no errors when keepBackup is used' '\n \ttest_when_finished \"git reset --hard HEAD\" &&\n+\tgit checkout -b test$test_count &&\n \ttest_config mergetool.keepBackup true &&\n \ttest_must_fail git merge move-to-b &&\n \t: >expect &&\n@@ -314,6 +317,7 @@ test_expect_success 'mergetool produces no errors when keepBackup is used' '\n \n test_expect_success 'mergetool honors tempfile config for deleted files' '\n \ttest_when_finished \"git reset --hard HEAD\" &&\n+\tgit checkout -b test$test_count &&\n \ttest_config mergetool.keepTemporaries false &&\n \ttest_must_fail git merge move-to-b &&\n \techo d | git mergetool a/a/file.txt &&\n@@ -323,6 +327,7 @@ test_expect_success 'mergetool honors tempfile config for deleted files' '\n test_expect_success 'mergetool keeps tempfiles when aborting delete/delete' '\n \ttest_when_finished \"git reset --hard HEAD\" &&\n \ttest_when_finished \"git clean -fdx\" &&\n+\tgit checkout -b test$test_count &&\n \ttest_config mergetool.keepTemporaries true &&\n \ttest_must_fail git merge move-to-b &&\n \t! (echo a; echo n) | git mergetool a/a/file.txt &&\n@@ -640,7 +645,7 @@ test_expect_success MKTEMP 'temporary filenames are used with mergetool.writeToT\n \n test_expect_success 'diff.orderFile configuration is honored' '\n \ttest_when_finished \"git reset --hard >/dev/null\" &&\n-\tgit checkout order-file-side2 &&\n+\tgit checkout -b test$test_count order-file-side2 &&\n \ttest_config diff.orderFile order-file &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n \ttest_config mergetool.myecho.trustExitCode true &&\n@@ -658,6 +663,7 @@ test_expect_success 'diff.orderFile configuration is honored' '\n '\n test_expect_success 'mergetool -Oorder-file is honored' '\n \ttest_when_finished \"git reset --hard >/dev/null 2>&1\" &&\n+\tgit checkout -b test$test_count &&\n \ttest_config diff.orderFile order-file &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n \ttest_config mergetool.myecho.trustExitCode true &&\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"309092","messageId":"20170109232941.43637-8-hansenr@google.com","threadId":"44811","inReplyTo":"20170109232941.43637-1-hansenr@google.com","subject":"[PATCH v4 07/14] t7610: run 'git reset --hard' after each test to clean up","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-09T23:29:34Z","receivedAt":"2017-01-09T23:30:45Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"Use test_when_finished to run 'git reset --hard' after each test so\nthat the repository is left in a saner state for the next test.\n\nThis is a step toward making the tests more independent so that if one\ntest fails it doesn't cause subsequent tests to fail.\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n t/t7610-mergetool.sh | 8 ++++++++\n 1 file changed, 8 insertions(+)\n\ndiff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh\nindex 2d92a2646..55587504e 100755\n--- a/t/t7610-mergetool.sh\n+++ b/t/t7610-mergetool.sh\n@@ -127,6 +127,7 @@ test_expect_success 'setup' '\n '\n \n test_expect_success 'custom mergetool' '\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \ttest_must_fail git merge master >/dev/null 2>&1 &&\n@@ -170,6 +171,7 @@ test_expect_success 'mergetool crlf' '\n '\n \n test_expect_success 'mergetool in subdir' '\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \t(\n@@ -181,6 +183,7 @@ test_expect_success 'mergetool in subdir' '\n '\n \n test_expect_success 'mergetool on file in parent dir' '\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit reset --hard &&\n \tgit submodule update -N &&\n \t(\n@@ -214,6 +217,7 @@ test_expect_success 'mergetool skips autoresolved' '\n '\n \n test_expect_success 'mergetool merges all from subdir' '\n+\ttest_when_finished \"git reset --hard\" &&\n \ttest_config rerere.enabled false &&\n \t(\n \t\tcd subdir &&\n@@ -244,6 +248,7 @@ test_expect_success 'mergetool skips resolved paths when rerere is active' '\n '\n \n test_expect_success 'conflicted stash sets up rerere'  '\n+\ttest_when_finished \"git reset --hard\" &&\n \ttest_config rerere.enabled true &&\n \tgit checkout stash1 &&\n \techo \"Conflicting stash content\" >file11 &&\n@@ -403,6 +408,7 @@ test_expect_success 'deleted vs modified submodule' '\n '\n \n test_expect_success 'file vs modified submodule' '\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \tmv submod submod-movedaside &&\n@@ -474,6 +480,7 @@ test_expect_success 'file vs modified submodule' '\n '\n \n test_expect_success 'submodule in subdirectory' '\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \t(\n@@ -535,6 +542,7 @@ test_expect_success 'submodule in subdirectory' '\n '\n \n test_expect_success 'directory vs modified submodule' '\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \tmv submod submod-movedaside &&\n \tgit rm --cached submod &&\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"309093","messageId":"20170109232941.43637-7-hansenr@google.com","threadId":"44811","inReplyTo":"20170109232941.43637-1-hansenr@google.com","subject":"[PATCH v4 06/14] t7610: don't rely on state from previous test","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-09T23:29:33Z","receivedAt":"2017-01-09T23:30:48Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"If the repository must be in a particular state (beyond what is\nalready done by the 'setup' test case) before the test can run, make\nthe necessary repository changes in the test script even if it means\nduplicating some lines of code from the previous test case.\n\nThis is a step toward making the tests more independent so that if one\ntest fails it doesn't cause subsequent tests to fail.\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n t/t7610-mergetool.sh | 6 ++++++\n 1 file changed, 6 insertions(+)\n\ndiff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh\nindex f62ceffdc..2d92a2646 100755\n--- a/t/t7610-mergetool.sh\n+++ b/t/t7610-mergetool.sh\n@@ -181,8 +181,12 @@ test_expect_success 'mergetool in subdir' '\n '\n \n test_expect_success 'mergetool on file in parent dir' '\n+\tgit reset --hard &&\n+\tgit submodule update -N &&\n \t(\n \t\tcd subdir &&\n+\t\ttest_must_fail git merge master >/dev/null 2>&1 &&\n+\t\t( yes \"\" | git mergetool file3 >/dev/null 2>&1 ) &&\n \t\t( yes \"\" | git mergetool ../file1 >/dev/null 2>&1 ) &&\n \t\t( yes \"\" | git mergetool ../file2 ../spaced\\ name >/dev/null 2>&1 ) &&\n \t\t( yes \"\" | git mergetool ../both >/dev/null 2>&1 ) &&\n@@ -651,6 +655,8 @@ test_expect_success 'mergetool -Oorder-file is honored' '\n \ttest_config diff.orderFile order-file &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n \ttest_config mergetool.myecho.trustExitCode true &&\n+\techo b >order-file &&\n+\techo a >>order-file &&\n \ttest_must_fail git merge order-file-side1 &&\n \tcat >expect <<-\\EOF &&\n \t\tMerging:\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"309094","messageId":"20170109232941.43637-4-hansenr@google.com","threadId":"44811","inReplyTo":"20170109232941.43637-1-hansenr@google.com","subject":"[PATCH v4 03/14] t7610: update branch names to match test number","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-09T23:29:30Z","receivedAt":"2017-01-09T23:30:51Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"Rename the testNN branches so that NN matches the test number.  This\nshould make it easier to troubleshoot test issues.  Use $test_count to\nkeep this future-proof.\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n t/t7610-mergetool.sh | 82 ++++++++++++++++++++++++++--------------------------\n 1 file changed, 41 insertions(+), 41 deletions(-)\n\ndiff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh\nindex 6d9f21511..14090739f 100755\n--- a/t/t7610-mergetool.sh\n+++ b/t/t7610-mergetool.sh\n@@ -94,7 +94,7 @@ test_expect_success 'setup' '\n '\n \n test_expect_success 'custom mergetool' '\n-\tgit checkout -b test1 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \ttest_must_fail git merge master >/dev/null 2>&1 &&\n \t( yes \"\" | git mergetool both >/dev/null 2>&1 ) &&\n@@ -113,7 +113,7 @@ test_expect_success 'custom mergetool' '\n \n test_expect_success 'mergetool crlf' '\n \ttest_config core.autocrlf true &&\n-\tgit checkout -b test2 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \ttest_must_fail git merge master >/dev/null 2>&1 &&\n \t( yes \"\" | git mergetool file1 >/dev/null 2>&1 ) &&\n \t( yes \"\" | git mergetool file2 >/dev/null 2>&1 ) &&\n@@ -134,7 +134,7 @@ test_expect_success 'mergetool crlf' '\n '\n \n test_expect_success 'mergetool in subdir' '\n-\tgit checkout -b test3 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \t(\n \t\tcd subdir &&\n@@ -161,7 +161,7 @@ test_expect_success 'mergetool on file in parent dir' '\n '\n \n test_expect_success 'mergetool skips autoresolved' '\n-\tgit checkout -b test4 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \ttest_must_fail git merge master &&\n \ttest -n \"$(git ls-files -u)\" &&\n@@ -192,7 +192,7 @@ test_expect_success 'mergetool merges all from subdir' '\n test_expect_success 'mergetool skips resolved paths when rerere is active' '\n \ttest_config rerere.enabled true &&\n \trm -rf .git/rr-cache &&\n-\tgit checkout -b test5 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \ttest_must_fail git merge master >/dev/null 2>&1 &&\n \t( yes \"l\" | git mergetool --no-prompt submod >/dev/null 2>&1 ) &&\n@@ -233,7 +233,7 @@ test_expect_success 'conflicted stash sets up rerere'  '\n test_expect_success 'mergetool takes partial path' '\n \tgit reset --hard &&\n \ttest_config rerere.enabled false &&\n-\tgit checkout -b test12 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \ttest_must_fail git merge master &&\n \n@@ -308,12 +308,12 @@ test_expect_success 'mergetool keeps tempfiles when aborting delete/delete' '\n '\n \n test_expect_success 'deleted vs modified submodule' '\n-\tgit checkout -b test6 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \tmv submod submod-movedaside &&\n \tgit rm --cached submod &&\n \tgit commit -m \"Submodule deleted from branch\" &&\n-\tgit checkout -b test6.a test6 &&\n+\tgit checkout -b test$test_count.a test$test_count &&\n \ttest_must_fail git merge master &&\n \ttest -n \"$(git ls-files -u)\" &&\n \t( yes \"\" | git mergetool file1 file2 spaced\\ name subdir/file3 >/dev/null 2>&1 ) &&\n@@ -329,7 +329,7 @@ test_expect_success 'deleted vs modified submodule' '\n \tgit commit -m \"Merge resolved by keeping module\" &&\n \n \tmv submod submod-movedaside &&\n-\tgit checkout -b test6.b test6 &&\n+\tgit checkout -b test$test_count.b test$test_count &&\n \tgit submodule update -N &&\n \ttest_must_fail git merge master &&\n \ttest -n \"$(git ls-files -u)\" &&\n@@ -343,9 +343,9 @@ test_expect_success 'deleted vs modified submodule' '\n \tgit commit -m \"Merge resolved by deleting module\" &&\n \n \tmv submod-movedaside submod &&\n-\tgit checkout -b test6.c master &&\n+\tgit checkout -b test$test_count.c master &&\n \tgit submodule update -N &&\n-\ttest_must_fail git merge test6 &&\n+\ttest_must_fail git merge test$test_count &&\n \ttest -n \"$(git ls-files -u)\" &&\n \t( yes \"\" | git mergetool file1 file2 spaced\\ name subdir/file3 >/dev/null 2>&1 ) &&\n \t( yes \"\" | git mergetool both >/dev/null 2>&1 ) &&\n@@ -359,9 +359,9 @@ test_expect_success 'deleted vs modified submodule' '\n \tgit commit -m \"Merge resolved by deleting module\" &&\n \tmv submod.orig submod &&\n \n-\tgit checkout -b test6.d master &&\n+\tgit checkout -b test$test_count.d master &&\n \tgit submodule update -N &&\n-\ttest_must_fail git merge test6 &&\n+\ttest_must_fail git merge test$test_count &&\n \ttest -n \"$(git ls-files -u)\" &&\n \t( yes \"\" | git mergetool file1 file2 spaced\\ name subdir/file3 >/dev/null 2>&1 ) &&\n \t( yes \"\" | git mergetool both >/dev/null 2>&1 ) &&\n@@ -377,14 +377,14 @@ test_expect_success 'deleted vs modified submodule' '\n '\n \n test_expect_success 'file vs modified submodule' '\n-\tgit checkout -b test7 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \tmv submod submod-movedaside &&\n \tgit rm --cached submod &&\n \techo not a submodule >submod &&\n \tgit add submod &&\n \tgit commit -m \"Submodule path becomes file\" &&\n-\tgit checkout -b test7.a branch1 &&\n+\tgit checkout -b test$test_count.a branch1 &&\n \ttest_must_fail git merge master &&\n \ttest -n \"$(git ls-files -u)\" &&\n \t( yes \"\" | git mergetool file1 file2 spaced\\ name subdir/file3 >/dev/null 2>&1 ) &&\n@@ -400,7 +400,7 @@ test_expect_success 'file vs modified submodule' '\n \tgit commit -m \"Merge resolved by keeping module\" &&\n \n \tmv submod submod-movedaside &&\n-\tgit checkout -b test7.b test7 &&\n+\tgit checkout -b test$test_count.b test$test_count &&\n \ttest_must_fail git merge master &&\n \ttest -n \"$(git ls-files -u)\" &&\n \t( yes \"\" | git mergetool file1 file2 spaced\\ name subdir/file3 >/dev/null 2>&1 ) &&\n@@ -413,11 +413,11 @@ test_expect_success 'file vs modified submodule' '\n \ttest \"$output\" = \"No files need merging\" &&\n \tgit commit -m \"Merge resolved by keeping file\" &&\n \n-\tgit checkout -b test7.c master &&\n+\tgit checkout -b test$test_count.c master &&\n \trmdir submod && mv submod-movedaside submod &&\n \ttest ! -e submod.orig &&\n \tgit submodule update -N &&\n-\ttest_must_fail git merge test7 &&\n+\ttest_must_fail git merge test$test_count &&\n \ttest -n \"$(git ls-files -u)\" &&\n \t( yes \"\" | git mergetool file1 file2 spaced\\ name subdir/file3 >/dev/null 2>&1 ) &&\n \t( yes \"\" | git mergetool both >/dev/null 2>&1 ) &&\n@@ -430,10 +430,10 @@ test_expect_success 'file vs modified submodule' '\n \ttest \"$output\" = \"No files need merging\" &&\n \tgit commit -m \"Merge resolved by keeping file\" &&\n \n-\tgit checkout -b test7.d master &&\n+\tgit checkout -b test$test_count.d master &&\n \trmdir submod && mv submod.orig submod &&\n \tgit submodule update -N &&\n-\ttest_must_fail git merge test7 &&\n+\ttest_must_fail git merge test$test_count &&\n \ttest -n \"$(git ls-files -u)\" &&\n \t( yes \"\" | git mergetool file1 file2 spaced\\ name subdir/file3 >/dev/null 2>&1 ) &&\n \t( yes \"\" | git mergetool both>/dev/null 2>&1 ) &&\n@@ -448,7 +448,7 @@ test_expect_success 'file vs modified submodule' '\n '\n \n test_expect_success 'submodule in subdirectory' '\n-\tgit checkout -b test10 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \t(\n \t\tcd subdir &&\n@@ -464,52 +464,52 @@ test_expect_success 'submodule in subdirectory' '\n \tgit add subdir/subdir_module &&\n \tgit commit -m \"add submodule in subdirectory\" &&\n \n-\tgit checkout -b test10.a test10 &&\n+\tgit checkout -b test$test_count.a test$test_count &&\n \tgit submodule update -N &&\n \t(\n \tcd subdir/subdir_module &&\n \t\tgit checkout -b super10.a &&\n-\t\techo test10.a >file15 &&\n+\t\techo test$test_count.a >file15 &&\n \t\tgit add file15 &&\n \t\tgit commit -m \"on branch 10.a\"\n \t) &&\n \tgit add subdir/subdir_module &&\n-\tgit commit -m \"change submodule in subdirectory on test10.a\" &&\n+\tgit commit -m \"change submodule in subdirectory on test$test_count.a\" &&\n \n-\tgit checkout -b test10.b test10 &&\n+\tgit checkout -b test$test_count.b test$test_count &&\n \tgit submodule update -N &&\n \t(\n \t\tcd subdir/subdir_module &&\n \t\tgit checkout -b super10.b &&\n-\t\techo test10.b >file15 &&\n+\t\techo test$test_count.b >file15 &&\n \t\tgit add file15 &&\n \t\tgit commit -m \"on branch 10.b\"\n \t) &&\n \tgit add subdir/subdir_module &&\n-\tgit commit -m \"change submodule in subdirectory on test10.b\" &&\n+\tgit commit -m \"change submodule in subdirectory on test$test_count.b\" &&\n \n-\ttest_must_fail git merge test10.a >/dev/null 2>&1 &&\n+\ttest_must_fail git merge test$test_count.a >/dev/null 2>&1 &&\n \t(\n \t\tcd subdir &&\n \t\t( yes \"l\" | git mergetool subdir_module )\n \t) &&\n-\ttest \"$(cat subdir/subdir_module/file15)\" = \"test10.b\" &&\n+\ttest \"$(cat subdir/subdir_module/file15)\" = \"test$test_count.b\" &&\n \tgit submodule update -N &&\n-\ttest \"$(cat subdir/subdir_module/file15)\" = \"test10.b\" &&\n+\ttest \"$(cat subdir/subdir_module/file15)\" = \"test$test_count.b\" &&\n \tgit reset --hard &&\n \tgit submodule update -N &&\n \n-\ttest_must_fail git merge test10.a >/dev/null 2>&1 &&\n+\ttest_must_fail git merge test$test_count.a >/dev/null 2>&1 &&\n \t( yes \"r\" | git mergetool subdir/subdir_module ) &&\n-\ttest \"$(cat subdir/subdir_module/file15)\" = \"test10.b\" &&\n+\ttest \"$(cat subdir/subdir_module/file15)\" = \"test$test_count.b\" &&\n \tgit submodule update -N &&\n-\ttest \"$(cat subdir/subdir_module/file15)\" = \"test10.a\" &&\n+\ttest \"$(cat subdir/subdir_module/file15)\" = \"test$test_count.a\" &&\n \tgit commit -m \"branch1 resolved with mergetool\" &&\n \trm -rf subdir/subdir_module\n '\n \n test_expect_success 'directory vs modified submodule' '\n-\tgit checkout -b test11 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \tmv submod submod-movedaside &&\n \tgit rm --cached submod &&\n \tmkdir submod &&\n@@ -537,9 +537,9 @@ test_expect_success 'directory vs modified submodule' '\n \ttest \"$(cat submod/bar)\" = \"master submodule\" &&\n \tgit reset --hard >/dev/null 2>&1 && rm -rf submod-movedaside &&\n \n-\tgit checkout -b test11.c master &&\n+\tgit checkout -b test$test_count.c master &&\n \tgit submodule update -N &&\n-\ttest_must_fail git merge test11 &&\n+\ttest_must_fail git merge test$test_count &&\n \ttest -n \"$(git ls-files -u)\" &&\n \t( yes \"l\" | git mergetool submod ) &&\n \tgit submodule update -N &&\n@@ -547,7 +547,7 @@ test_expect_success 'directory vs modified submodule' '\n \n \tgit reset --hard >/dev/null 2>&1 &&\n \tgit submodule update -N &&\n-\ttest_must_fail git merge test11 &&\n+\ttest_must_fail git merge test$test_count &&\n \ttest -n \"$(git ls-files -u)\" &&\n \ttest ! -e submod.orig &&\n \t( yes \"r\" | git mergetool submod ) &&\n@@ -559,7 +559,7 @@ test_expect_success 'directory vs modified submodule' '\n '\n \n test_expect_success 'file with no base' '\n-\tgit checkout -b test13 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \ttest_must_fail git merge master &&\n \tgit mergetool --no-prompt --tool mybase -- both &&\n \t>expected &&\n@@ -568,7 +568,7 @@ test_expect_success 'file with no base' '\n '\n \n test_expect_success 'custom commands override built-ins' '\n-\tgit checkout -b test14 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \ttest_config mergetool.defaults.cmd \"cat \\\"\\$REMOTE\\\" >\\\"\\$MERGED\\\"\" &&\n \ttest_config mergetool.defaults.trustExitCode true &&\n \ttest_must_fail git merge master &&\n@@ -579,7 +579,7 @@ test_expect_success 'custom commands override built-ins' '\n '\n \n test_expect_success 'filenames seen by tools start with ./' '\n-\tgit checkout -b test15 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \ttest_config mergetool.writeToTemp false &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n \ttest_config mergetool.myecho.trustExitCode true &&\n@@ -595,7 +595,7 @@ test_lazy_prereq MKTEMP '\n '\n \n test_expect_success MKTEMP 'temporary filenames are used with mergetool.writeToTemp' '\n-\tgit checkout -b test16 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \ttest_config mergetool.writeToTemp true &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n \ttest_config mergetool.myecho.trustExitCode true &&\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"309095","messageId":"xmqqvatnstba.fsf@gitster.mtv.corp.google.com","threadId":"44811","inReplyTo":"xmqq37gru819.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH v3 13/13] mergetool: fix running in subdir when rerere enabled","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-01-09T23:32:41Z","receivedAt":"2017-01-09T23:32:48Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> By the way, I didn't think this through, but how is the orderfile\n> that comes from the configuration file handled when it is not an\n> absolute path?  I think it is _wrong_ to take it as relative to\n> where the user started the program.\n\nAnswering my own question: the program does not handle configured\norderfile at all, so there is no gotcha ;-)\n"},{"id":"309096","messageId":"f0bf49ae-7c3b-4118-bc6a-2aee8f58fc03@google.com","threadId":"44811","inReplyTo":"xmqq37gru819.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH v3 13/13] mergetool: fix running in subdir when rerere enabled","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-09T23:50:24Z","receivedAt":"2017-01-09T23:50:32Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"On 2017-01-09 18:29, Junio C Hamano wrote:\n> Junio C Hamano <gitster@pobox.com> writes:\n>\n>> Junio C Hamano <gitster@pobox.com> writes:\n>>\n>>> I wonder if it makes more sense to always move to toplevel upfront\n>>> and consistently use path from the toplevel, perhaps like the patch\n>>\n>> s/the patch/the attached patch/ I meant.\n>>\n>>> does.  The first hunk is what you wrote but only inside MERGE_RR\n>>> block, and the second hunk deals with converting end-user supplied\n>>> paths that are relative to the original relative to the top-level.\n>>>\n>>> The tweaking of $orderfile you have in the first hunk may have to be\n>>> tightened mimicking the way how \"eval ... --sq ... ; shift\" is used\n>>> in the second hunk to avoid confusion in case orderfile specified by\n>>> the end user happens to be the same as a valid revname\n>>> (e.g. \"master\").\n>>\n>> And here is a squash-able patch to illustrate what I mean.\n>\n> By the way, I didn't think this through, but how is the orderfile\n> that comes from the configuration file handled when it is not an\n> absolute path?\n\nGood question; it does whatever 'git diff' does, and that case isn't \ndocumented.  It's also unclear if the globs are like the .gitignore \npatterns.\n\nI would expect it to act like $GIT_DIR/info/exclude, but I haven't checked.\n\n> I think it is _wrong_ to take it as relative to\n> where the user started the program.\n\nAgreed.\n\n> The -O<file> parameter from the\n> command line, when <file> is not absolute, should be taken as\n> relative to where the user _thinks_ s/he is,\n\nAgreed.\n\n> but when it comes from\n> the diff.orderfile configuration and it is not absolute, it should\n> be taken as relative to the top of the working tree.\n\nAgreed.\n\n> As we always\n> cd_to_top with the suggested SQUASH, it means that the orderfile\n> that came from the configuration does not have to be touched, while\n> the orderfile given via -O<file> on the command line needs\n> prefixing.\n\nYes.  By unconditionally running cd_to_top we should get the behavior we \nwant even if 'git diff' uses the current working directory rather than \nthe top-level directory.\n\nI'll poke at 'git diff' to see what it does.\n\n-Richard\n"},{"id":"309105","messageId":"20170110043646.qfwcn7d7klag7qtf@gmail.com","threadId":"44811","inReplyTo":"20170104005042.51530-1-hansenr@google.com","subject":"Re: [PATCH 0/4] fix mergetool+rerere+subdir regression","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2017-01-10T04:36:46Z","receivedAt":"2017-01-10T04:36:57Z","isPatch":true,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"On Tue, Jan 03, 2017 at 07:50:38PM -0500, Richard Hansen wrote:\n> If rerere is enabled, no pathnames are given, and mergetool is run\n> from a subdirectory, mergetool always prints \"No files need merging\".\n> Fix the bug.\n> \n> This regression was introduced in\n> 57937f70a09c12ef484c290865dac4066d207c9c (v2.11.0).\n> \n> Richard Hansen (4):\n>   t7610: update branch names to match test number\n>   t7610: make tests more independent and debuggable\n>   t7610: add test case for rerere+mergetool+subdir bug\n>   mergetool: fix running in subdir when rerere enabled\n> \n>  git-mergetool.sh     |   1 +\n>  t/t7610-mergetool.sh | 132 ++++++++++++++++++++++++++++++++++-----------------\n>  2 files changed, 90 insertions(+), 43 deletions(-)\n\nThanks for finding these, this reminds me very much of the\nrecent fixes that had to be done to difftool.\n\nI tested this so,\n\nAcked-by: David Aguilar <davvid@gmail.com>\n-- \nDavid\n"},{"id":"309107","messageId":"3a09e318-f14b-5f14-a992-3bd045f0a4c6@kdbg.org","threadId":"44811","inReplyTo":"20170109232941.43637-15-hansenr@google.com","subject":"Re: [PATCH v4 14/14] mergetool: fix running in subdir when rerere enabled","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2017-01-10T06:17:51Z","receivedAt":"2017-01-10T06:18:12Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 10.01.2017 um 00:29 schrieb Richard Hansen:\n> The pathnames output by the 'git rerere remaining' command are\n> relative to the top-level directory but the 'git diff --name-only'\n> command expects its pathname arguments to be relative to the current\n> working directory.  Run cd_to_toplevel before running 'git diff\n> --name-only' and adjust any relative pathnames so that 'git mergetool'\n> does not fail when run from a subdirectory with rerere enabled.\n>\n> This fixes a regression introduced in\n> 57937f70a09c12ef484c290865dac4066d207c9c (v2.11.0).\n>\n> Based-on-patch-by: Junio C Hamano <gitster@pobox.com>\n> Signed-off-by: Richard Hansen <hansenr@google.com>\n> ---\n>  git-mergetool.sh     | 16 ++++++++++++++--\n>  t/t7610-mergetool.sh |  7 ++++++-\n>  2 files changed, 20 insertions(+), 3 deletions(-)\n>\n> diff --git a/git-mergetool.sh b/git-mergetool.sh\n> index b506896dc..cba6bbd05 100755\n> --- a/git-mergetool.sh\n> +++ b/git-mergetool.sh\n> @@ -454,6 +454,15 @@ main () {\n>  \tmerge_keep_backup=\"$(git config --bool mergetool.keepBackup || echo true)\"\n>  \tmerge_keep_temporaries=\"$(git config --bool mergetool.keepTemporaries || echo false)\"\n>\n> +\tprefix=$(git rev-parse --show-prefix) || exit 1\n> +\tcd_to_toplevel\n> +\n> +\tif test -n \"$orderfile\"\n> +\tthen\n> +\t\torderfile=$(git rev-parse --prefix \"$prefix\" -- \"$orderfile\") || exit 1\n> +\t\torderfile=$(printf %s\\\\n \"$orderfile\" | sed -e 1d)\n\nIs the purpose of this complication only to detect errors of the git \ninvocation? IMHO, we could dispense with that, but others might \ndisagree. I am arguing because this adds yet another process; but it is \nonly paid when -O is used, so...\n\n> +\tfi\n> +\n>  \tif test $# -eq 0 && test -e \"$GIT_DIR/MERGE_RR\"\n>  \tthen\n>  \t\tset -- $(git rerere remaining)\n> @@ -461,14 +470,17 @@ main () {\n>  \t\tthen\n>  \t\t\tprint_noop_and_exit\n>  \t\tfi\n> +\telif test $# -ge 0\n> +\tthen\n> +\t\tfiles_quoted=$(git rev-parse --sq --prefix \"$prefix\" -- \"$@\") || exit 1\n> +\t\teval \"set -- $files_quoted\"\n\nBTW, the --sq and eval business is not required here. At this point, \n$IFS = $'\\n', so\n\n\t\tset -- $(git rev-parse --sq --prefix \"$prefix\" -- \"$@\")\n\nwill do. (Except that it would not detect errors.)\n\n> +\t\tshift\n>  \tfi\n\nAs I don't see anything wrong with what you have written, these comments \nalone do not warrant another re-roll.\n\n-- Hannes\n\n"},{"id":"309146","messageId":"10bd75ad-15d6-5694-bdf1-6b820d0b3201@google.com","threadId":"44811","inReplyTo":"3a09e318-f14b-5f14-a992-3bd045f0a4c6@kdbg.org","subject":"Re: [PATCH v4 14/14] mergetool: fix running in subdir when rerere enabled","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-10T17:09:34Z","receivedAt":"2017-01-10T17:09:42Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"On 2017-01-10 01:17, Johannes Sixt wrote:\n> Am 10.01.2017 um 00:29 schrieb Richard Hansen:\n>> The pathnames output by the 'git rerere remaining' command are\n>> relative to the top-level directory but the 'git diff --name-only'\n>> command expects its pathname arguments to be relative to the current\n>> working directory.  Run cd_to_toplevel before running 'git diff\n>> --name-only' and adjust any relative pathnames so that 'git mergetool'\n>> does not fail when run from a subdirectory with rerere enabled.\n>>\n>> This fixes a regression introduced in\n>> 57937f70a09c12ef484c290865dac4066d207c9c (v2.11.0).\n>>\n>> Based-on-patch-by: Junio C Hamano <gitster@pobox.com>\n>> Signed-off-by: Richard Hansen <hansenr@google.com>\n>> ---\n>>  git-mergetool.sh     | 16 ++++++++++++++--\n>>  t/t7610-mergetool.sh |  7 ++++++-\n>>  2 files changed, 20 insertions(+), 3 deletions(-)\n>>\n>> diff --git a/git-mergetool.sh b/git-mergetool.sh\n>> index b506896dc..cba6bbd05 100755\n>> --- a/git-mergetool.sh\n>> +++ b/git-mergetool.sh\n>> @@ -454,6 +454,15 @@ main () {\n>>      merge_keep_backup=\"$(git config --bool mergetool.keepBackup || echo true)\"\n>>      merge_keep_temporaries=\"$(git config --bool mergetool.keepTemporaries || echo false)\"\n>>\n>> +    prefix=$(git rev-parse --show-prefix) || exit 1\n>> +    cd_to_toplevel\n>> +\n>> +    if test -n \"$orderfile\"\n>> +    then\n>> +        orderfile=$(git rev-parse --prefix \"$prefix\" -- \"$orderfile\") || exit 1\n>> +        orderfile=$(printf %s\\\\n \"$orderfile\" | sed -e 1d)\n>\n> Is the purpose of this complication only to detect errors of the git\n> invocation?\n\nYes.  I've been burned so many times by the shell not stopping when \nthere's an error that I always like to do things one step at a time with \nerror checking, even if it is less efficient.\n\n> IMHO, we could dispense with that, but others might\n> disagree. I am arguing because this adds yet another process; but it is\n> only paid when -O is used, so...\n>\n>> +    fi\n>> +\n>>      if test $# -eq 0 && test -e \"$GIT_DIR/MERGE_RR\"\n>>      then\n>>          set -- $(git rerere remaining)\n>> @@ -461,14 +470,17 @@ main () {\n>>          then\n>>              print_noop_and_exit\n>>          fi\n>> +    elif test $# -ge 0\n>> +    then\n>> +        files_quoted=$(git rev-parse --sq --prefix \"$prefix\" -- \"$@\") || exit 1\n>> +        eval \"set -- $files_quoted\"\n>\n> BTW, the --sq and eval business is not required here. At this point,\n> $IFS = $'\\n',\n\nWhoa, really?  That's surprising and feels wrong.\n\n(BTW, I just noticed that guess_merge_tool sets IFS to a space without \nresetting it afterward.  That function is always run in a subshell so \nthere's no problem at the moment, but it's still a bit risky.)\n\n> so\n>\n>         set -- $(git rev-parse --sq --prefix \"$prefix\" -- \"$@\")\n>\n> will do. (Except that it would not detect errors.)\n\nI think I would prefer to leave it as-is in case IFS is ever changed \nback to the default.\n\n>\n>> +        shift\n>>      fi\n>\n> As I don't see anything wrong with what you have written, these comments\n> alone do not warrant another re-roll.\n\nI'll reroll if I hear other votes in favor of changing.  Thanks for \nreviewing!\n\n-Richard\n\n>\n> -- Hannes\n>\n\n"},{"id":"309151","messageId":"xmqqmveyson3.fsf@gitster.mtv.corp.google.com","threadId":"44811","inReplyTo":"3a09e318-f14b-5f14-a992-3bd045f0a4c6@kdbg.org","subject":"Re: [PATCH v4 14/14] mergetool: fix running in subdir when rerere enabled","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-01-10T19:25:52Z","receivedAt":"2017-01-10T19:26:10Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <j6t@kdbg.org> writes:\n\n>> +\tprefix=$(git rev-parse --show-prefix) || exit 1\n>> +\tcd_to_toplevel\n>> +\n>> +\tif test -n \"$orderfile\"\n>> +\tthen\n>> +\t\torderfile=$(git rev-parse --prefix \"$prefix\" -- \"$orderfile\") || exit 1\n>> +\t\torderfile=$(printf %s\\\\n \"$orderfile\" | sed -e 1d)\n>\n> Is the purpose of this complication only to detect errors of the git\n> invocation? IMHO, we could dispense with that, but others might\n> disagree. I am arguing because this adds yet another process; but it\n> is only paid when -O is used, so...\n\nI do not terribly mind an added process, but this change makes it\nharder to read and also forces the readers to wonder if the quoting\naround printf is correct.\n\n>> @@ -461,14 +470,17 @@ main () {\n>>  \t\tthen\n>>  \t\t\tprint_noop_and_exit\n>>  \t\tfi\n>> +\telif test $# -ge 0\n>> +\tthen\n>> +\t\tfiles_quoted=$(git rev-parse --sq --prefix \"$prefix\" -- \"$@\") || exit 1\n>> +\t\teval \"set -- $files_quoted\"\n>\n> BTW, the --sq and eval business is not required here. At this point,\n> $IFS = $'\\n', so\n>\n> \t\tset -- $(git rev-parse --sq --prefix \"$prefix\" -- \"$@\")\n>\n> will do. (Except that it would not detect errors.)\n\nI thought you are suggesting not to use --sq but it is still there.\nI think the original is written in such a way that any letter in\neach of \"$@\" is preserved, even an LF in the filename.\n\nSuch a pathname probably won't correctly be given from the \"rerere\nremaining\" side (i.e. when you are lazy and run mergetool without\npathname), so it may appear not to matter, but being able to give an\nexplicit pathname from the command line is a workaround for that, so\nin that sense, it has value to prepare this side of the codepath to\nbe able to cope with such a pathname.\n\nUnrelated, but I notice that in this:\n\n    eval \"set -- $(git rev-parse --sq --prefix \"$prefix\" -- \"$@\")\"\n    shift\n\n\"set\" will get one \"--\" from its direct command line argument,\nfollowed by \"--\" that comes out of rev-parse, and then the first\npathname (i.e. \"$prefix/$1\", if \"$1\" is relative).  Then the first\n\"--\" is discarded and the second \"--\" that came out of rev-parse\nbecomes \"$1\", and the first pathname becomes \"$2\", etc.  We use\n\"shift\" to get rid of \"--\" and move everything down by one.\n\nIt is my fault but it is a roundabout way to say:\n\n    eval \"set $(git rev-parse --sq --prefix \"$prefix\" -- \"$@\")\"\n\nI would think, and we should probably want to write this like so.\n[PATCH v4 02/14] would probably want to be updated as well.\n\nI can locally update them if everybody agrees it is a good idea.\n"},{"id":"309160","messageId":"15bc6621-4131-032c-4af6-8c76a366e4d8@kdbg.org","threadId":"44811","inReplyTo":"xmqqmveyson3.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH v4 14/14] mergetool: fix running in subdir when rerere enabled","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2017-01-10T20:29:43Z","receivedAt":"2017-01-10T20:32:31Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 10.01.2017 um 20:25 schrieb Junio C Hamano:\n> Johannes Sixt <j6t@kdbg.org> writes:\n>> BTW, the --sq and eval business is not required here. At this point,\n>> $IFS = $'\\n', so\n>>\n>> \t\tset -- $(git rev-parse --sq --prefix \"$prefix\" -- \"$@\")\n>>\n>> will do. (Except that it would not detect errors.)\n>\n> I thought you are suggesting not to use --sq but it is still there.\n\nA copy-paste-p. Of course, I want to suggest not to use --sq.\n\n> Unrelated, but I notice that in this:\n>\n>     eval \"set -- $(git rev-parse --sq --prefix \"$prefix\" -- \"$@\")\"\n>     shift\n>\n> It is my fault but it is a roundabout way to say:\n>\n>     eval \"set $(git rev-parse --sq --prefix \"$prefix\" -- \"$@\")\"\n\nClever! But I fear that half a year down the road we will appreciate a \ncomment like\n\n\t# rev-parse provides the -- needed for `set`\n\nand then we are back at two lines, so I dunno...\n\n-- Hannes\n\n"},{"id":"309163","messageId":"20170110204202.21779-2-hansenr@google.com","threadId":"44811","inReplyTo":"20170110204202.21779-1-hansenr@google.com","subject":"[PATCH v5 01/14] .mailmap: Use my personal email address as my canonical","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-10T20:41:49Z","receivedAt":"2017-01-10T20:42:51Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"When I changed employers my work address changed from rhansen@bbn.com\nto hansenr@google.com.  Rather than map my old work address to my new,\nmap them both to my permanent personal email address.  (I will still\nuse my work address in commits I submit so that my employer gets some\ncredit.)\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n .mailmap | 2 ++\n 1 file changed, 2 insertions(+)\n\ndiff --git a/.mailmap b/.mailmap\nindex 9cc33e925..9c87a3840 100644\n--- a/.mailmap\n+++ b/.mailmap\n@@ -192,6 +192,8 @@ Philippe Bruhat <book@cpan.org>\n Ralf Thielow <ralf.thielow@gmail.com> <ralf.thielow@googlemail.com>\n Ramsay Jones <ramsay@ramsayjones.plus.com> <ramsay@ramsay1.demon.co.uk>\n René Scharfe <l.s.r@web.de> <rene.scharfe@lsrfire.ath.cx>\n+Richard Hansen <rhansen@rhansen.org> <hansenr@google.com>\n+Richard Hansen <rhansen@rhansen.org> <rhansen@bbn.com>\n Robert Fitzsimons <robfitz@273k.net>\n Robert Shearman <robertshearman@gmail.com> <rob@codeweavers.com>\n Robert Zeh <robert.a.zeh@gmail.com>\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"309164","messageId":"20170110204202.21779-1-hansenr@google.com","threadId":"44811","inReplyTo":"20170109232941.43637-1-hansenr@google.com","subject":"[PATCH v5 00/14] fix mergetool+rerere+subdir regression","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-10T20:41:48Z","receivedAt":"2017-01-10T20:42:54Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"If rerere is enabled, no pathnames are given, and mergetool is run\nfrom a subdirectory, mergetool always prints \"No files need merging\".\nFix the bug.\n\nThis regression was introduced in\n57937f70a09c12ef484c290865dac4066d207c9c (v2.11.0).\n\nChanges since v4:\n  * Revert to Junio's original proposal for 14/14.  (Junio:  Please\n    feel free to take author credit on 14/4; it's now 100% your code.)\n  * Do:\n        # rev-parse provides the -- needed for 'set'\n        eval \"set $(git rev-parse --sq -- \"$@\")\"\n    instead of:\n        eval \"set -- $(git rev-parse --sq -- \"$@\")\"\n        shift\n    for both 02/14 and 14/14.\n\nRichard Hansen (14):\n  .mailmap: Use my personal email address as my canonical\n  rev-parse doc: pass \"--\" to rev-parse in the --prefix example\n  t7610: update branch names to match test number\n  t7610: Move setup code to the 'setup' test case.\n  t7610: use test_when_finished for cleanup tasks\n  t7610: don't rely on state from previous test\n  t7610: run 'git reset --hard' after each test to clean up\n  t7610: delete some now-unnecessary 'git reset --hard' lines\n  t7610: always work on a test-specific branch\n  t7610: don't assume the checked-out commit\n  t7610: spell 'git reset --hard' consistently\n  t7610: add test case for rerere+mergetool+subdir bug\n  mergetool: take the \"-O\" out of $orderfile\n  mergetool: fix running in subdir when rerere enabled\n\n .mailmap                        |   2 +\n Documentation/git-rev-parse.txt |   3 +-\n git-mergetool.sh                |  21 ++-\n t/t7610-mergetool.sh            | 281 ++++++++++++++++++++++++----------------\n 4 files changed, 187 insertions(+), 120 deletions(-)\n\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"309165","messageId":"20170110204202.21779-10-hansenr@google.com","threadId":"44811","inReplyTo":"20170110204202.21779-1-hansenr@google.com","subject":"[PATCH v5 09/14] t7610: always work on a test-specific branch","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-10T20:41:57Z","receivedAt":"2017-01-10T20:43:00Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"Create and use a test-specific branch when the test might create a\ncommit.  This is not always necessary for correctness, but it improves\ndebuggability by ensuring a commit created by test #N shows up on the\ntestN branch, not the branch for test #N-1.\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n t/t7610-mergetool.sh | 10 ++++++++--\n 1 file changed, 8 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh\nindex 7d5e1df88..efcf5c3f1 100755\n--- a/t/t7610-mergetool.sh\n+++ b/t/t7610-mergetool.sh\n@@ -184,6 +184,7 @@ test_expect_success 'mergetool in subdir' '\n \n test_expect_success 'mergetool on file in parent dir' '\n \ttest_when_finished \"git reset --hard\" &&\n+\tgit checkout -b test$test_count &&\n \tgit submodule update -N &&\n \t(\n \t\tcd subdir &&\n@@ -217,6 +218,7 @@ test_expect_success 'mergetool skips autoresolved' '\n \n test_expect_success 'mergetool merges all from subdir' '\n \ttest_when_finished \"git reset --hard\" &&\n+\tgit checkout -b test$test_count &&\n \ttest_config rerere.enabled false &&\n \t(\n \t\tcd subdir &&\n@@ -288,7 +290,7 @@ test_expect_success 'mergetool takes partial path' '\n \n test_expect_success 'mergetool delete/delete conflict' '\n \ttest_when_finished \"git reset --hard HEAD\" &&\n-\tgit checkout move-to-c &&\n+\tgit checkout -b test$test_count move-to-c &&\n \ttest_must_fail git merge move-to-b &&\n \techo d | git mergetool a/a/file.txt &&\n \t! test -f a/a/file.txt &&\n@@ -304,6 +306,7 @@ test_expect_success 'mergetool delete/delete conflict' '\n \n test_expect_success 'mergetool produces no errors when keepBackup is used' '\n \ttest_when_finished \"git reset --hard HEAD\" &&\n+\tgit checkout -b test$test_count &&\n \ttest_config mergetool.keepBackup true &&\n \ttest_must_fail git merge move-to-b &&\n \t: >expect &&\n@@ -314,6 +317,7 @@ test_expect_success 'mergetool produces no errors when keepBackup is used' '\n \n test_expect_success 'mergetool honors tempfile config for deleted files' '\n \ttest_when_finished \"git reset --hard HEAD\" &&\n+\tgit checkout -b test$test_count &&\n \ttest_config mergetool.keepTemporaries false &&\n \ttest_must_fail git merge move-to-b &&\n \techo d | git mergetool a/a/file.txt &&\n@@ -323,6 +327,7 @@ test_expect_success 'mergetool honors tempfile config for deleted files' '\n test_expect_success 'mergetool keeps tempfiles when aborting delete/delete' '\n \ttest_when_finished \"git reset --hard HEAD\" &&\n \ttest_when_finished \"git clean -fdx\" &&\n+\tgit checkout -b test$test_count &&\n \ttest_config mergetool.keepTemporaries true &&\n \ttest_must_fail git merge move-to-b &&\n \t! (echo a; echo n) | git mergetool a/a/file.txt &&\n@@ -640,7 +645,7 @@ test_expect_success MKTEMP 'temporary filenames are used with mergetool.writeToT\n \n test_expect_success 'diff.orderFile configuration is honored' '\n \ttest_when_finished \"git reset --hard >/dev/null\" &&\n-\tgit checkout order-file-side2 &&\n+\tgit checkout -b test$test_count order-file-side2 &&\n \ttest_config diff.orderFile order-file &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n \ttest_config mergetool.myecho.trustExitCode true &&\n@@ -658,6 +663,7 @@ test_expect_success 'diff.orderFile configuration is honored' '\n '\n test_expect_success 'mergetool -Oorder-file is honored' '\n \ttest_when_finished \"git reset --hard >/dev/null 2>&1\" &&\n+\tgit checkout -b test$test_count &&\n \ttest_config diff.orderFile order-file &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n \ttest_config mergetool.myecho.trustExitCode true &&\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"309166","messageId":"20170110204202.21779-12-hansenr@google.com","threadId":"44811","inReplyTo":"20170110204202.21779-1-hansenr@google.com","subject":"[PATCH v5 11/14] t7610: spell 'git reset --hard' consistently","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-10T20:41:59Z","receivedAt":"2017-01-10T20:43:03Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"Signed-off-by: Richard Hansen <hansenr@google.com>\n---\n t/t7610-mergetool.sh | 37 +++++++++++++++++++------------------\n 1 file changed, 19 insertions(+), 18 deletions(-)\n\ndiff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh\nindex 54164a320..c031ecd9e 100755\n--- a/t/t7610-mergetool.sh\n+++ b/t/t7610-mergetool.sh\n@@ -289,23 +289,23 @@ test_expect_success 'mergetool takes partial path' '\n '\n \n test_expect_success 'mergetool delete/delete conflict' '\n-\ttest_when_finished \"git reset --hard HEAD\" &&\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count move-to-c &&\n \ttest_must_fail git merge move-to-b &&\n \techo d | git mergetool a/a/file.txt &&\n \t! test -f a/a/file.txt &&\n-\tgit reset --hard HEAD &&\n+\tgit reset --hard &&\n \ttest_must_fail git merge move-to-b &&\n \techo m | git mergetool a/a/file.txt &&\n \ttest -f b/b/file.txt &&\n-\tgit reset --hard HEAD &&\n+\tgit reset --hard &&\n \ttest_must_fail git merge move-to-b &&\n \t! echo a | git mergetool a/a/file.txt &&\n \t! test -f a/a/file.txt\n '\n \n test_expect_success 'mergetool produces no errors when keepBackup is used' '\n-\ttest_when_finished \"git reset --hard HEAD\" &&\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count move-to-c &&\n \ttest_config mergetool.keepBackup true &&\n \ttest_must_fail git merge move-to-b &&\n@@ -316,7 +316,7 @@ test_expect_success 'mergetool produces no errors when keepBackup is used' '\n '\n \n test_expect_success 'mergetool honors tempfile config for deleted files' '\n-\ttest_when_finished \"git reset --hard HEAD\" &&\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count move-to-c &&\n \ttest_config mergetool.keepTemporaries false &&\n \ttest_must_fail git merge move-to-b &&\n@@ -325,7 +325,7 @@ test_expect_success 'mergetool honors tempfile config for deleted files' '\n '\n \n test_expect_success 'mergetool keeps tempfiles when aborting delete/delete' '\n-\ttest_when_finished \"git reset --hard HEAD\" &&\n+\ttest_when_finished \"git reset --hard\" &&\n \ttest_when_finished \"git clean -fdx\" &&\n \tgit checkout -b test$test_count move-to-c &&\n \ttest_config mergetool.keepTemporaries true &&\n@@ -342,7 +342,7 @@ test_expect_success 'mergetool keeps tempfiles when aborting delete/delete' '\n '\n \n test_expect_success 'deleted vs modified submodule' '\n-\ttest_when_finished \"git reset --hard HEAD\" &&\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \tmv submod submod-movedaside &&\n@@ -560,7 +560,7 @@ test_expect_success 'directory vs modified submodule' '\n \ttest \"$(cat submod/file16)\" = \"not a submodule\" &&\n \trm -rf submod.orig &&\n \n-\tgit reset --hard >/dev/null 2>&1 &&\n+\tgit reset --hard &&\n \ttest_must_fail git merge master &&\n \ttest -n \"$(git ls-files -u)\" &&\n \ttest ! -e submod.orig &&\n@@ -572,7 +572,8 @@ test_expect_success 'directory vs modified submodule' '\n \t( cd submod && git clean -f && git reset --hard ) &&\n \tgit submodule update -N &&\n \ttest \"$(cat submod/bar)\" = \"master submodule\" &&\n-\tgit reset --hard >/dev/null 2>&1 && rm -rf submod-movedaside &&\n+\tgit reset --hard &&\n+\trm -rf submod-movedaside &&\n \n \tgit checkout -b test$test_count.c master &&\n \tgit submodule update -N &&\n@@ -582,7 +583,7 @@ test_expect_success 'directory vs modified submodule' '\n \tgit submodule update -N &&\n \ttest \"$(cat submod/bar)\" = \"master submodule\" &&\n \n-\tgit reset --hard >/dev/null 2>&1 &&\n+\tgit reset --hard &&\n \tgit submodule update -N &&\n \ttest_must_fail git merge test$test_count &&\n \ttest -n \"$(git ls-files -u)\" &&\n@@ -590,13 +591,13 @@ test_expect_success 'directory vs modified submodule' '\n \t( yes \"r\" | git mergetool submod ) &&\n \ttest \"$(cat submod/file16)\" = \"not a submodule\" &&\n \n-\tgit reset --hard master >/dev/null 2>&1 &&\n+\tgit reset --hard master &&\n \t( cd submod && git clean -f && git reset --hard ) &&\n \tgit submodule update -N\n '\n \n test_expect_success 'file with no base' '\n-\ttest_when_finished \"git reset --hard master >/dev/null 2>&1\" &&\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \ttest_must_fail git merge master &&\n \tgit mergetool --no-prompt --tool mybase -- both &&\n@@ -605,7 +606,7 @@ test_expect_success 'file with no base' '\n '\n \n test_expect_success 'custom commands override built-ins' '\n-\ttest_when_finished \"git reset --hard master >/dev/null 2>&1\" &&\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \ttest_config mergetool.defaults.cmd \"cat \\\"\\$REMOTE\\\" >\\\"\\$MERGED\\\"\" &&\n \ttest_config mergetool.defaults.trustExitCode true &&\n@@ -616,7 +617,7 @@ test_expect_success 'custom commands override built-ins' '\n '\n \n test_expect_success 'filenames seen by tools start with ./' '\n-\ttest_when_finished \"git reset --hard master >/dev/null 2>&1\" &&\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \ttest_config mergetool.writeToTemp false &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n@@ -632,7 +633,7 @@ test_lazy_prereq MKTEMP '\n '\n \n test_expect_success MKTEMP 'temporary filenames are used with mergetool.writeToTemp' '\n-\ttest_when_finished \"git reset --hard master >/dev/null 2>&1\" &&\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \ttest_config mergetool.writeToTemp true &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n@@ -644,7 +645,7 @@ test_expect_success MKTEMP 'temporary filenames are used with mergetool.writeToT\n '\n \n test_expect_success 'diff.orderFile configuration is honored' '\n-\ttest_when_finished \"git reset --hard >/dev/null\" &&\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count order-file-side2 &&\n \ttest_config diff.orderFile order-file &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n@@ -662,7 +663,7 @@ test_expect_success 'diff.orderFile configuration is honored' '\n \ttest_cmp expect actual\n '\n test_expect_success 'mergetool -Oorder-file is honored' '\n-\ttest_when_finished \"git reset --hard >/dev/null 2>&1\" &&\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count order-file-side2 &&\n \ttest_config diff.orderFile order-file &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n@@ -678,7 +679,7 @@ test_expect_success 'mergetool -Oorder-file is honored' '\n \tgit mergetool -O/dev/null --no-prompt --tool myecho >output &&\n \tgit grep --no-index -h -A2 Merging: output >actual &&\n \ttest_cmp expect actual &&\n-\tgit reset --hard >/dev/null 2>&1 &&\n+\tgit reset --hard &&\n \n \tgit config --unset diff.orderFile &&\n \ttest_must_fail git merge order-file-side1 &&\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"309167","messageId":"20170110204202.21779-11-hansenr@google.com","threadId":"44811","inReplyTo":"20170110204202.21779-1-hansenr@google.com","subject":"[PATCH v5 10/14] t7610: don't assume the checked-out commit","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-10T20:41:58Z","receivedAt":"2017-01-10T20:43:06Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"Always check out the required commit at the beginning of the test so\nthat a failure in a previous test does not cause the test to work off\nof the wrong commit.\n\nThis is a step toward making the tests more independent so that if one\ntest fails it doesn't cause subsequent tests to fail.\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n t/t7610-mergetool.sh | 12 ++++++------\n 1 file changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh\nindex efcf5c3f1..54164a320 100755\n--- a/t/t7610-mergetool.sh\n+++ b/t/t7610-mergetool.sh\n@@ -184,7 +184,7 @@ test_expect_success 'mergetool in subdir' '\n \n test_expect_success 'mergetool on file in parent dir' '\n \ttest_when_finished \"git reset --hard\" &&\n-\tgit checkout -b test$test_count &&\n+\tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \t(\n \t\tcd subdir &&\n@@ -218,7 +218,7 @@ test_expect_success 'mergetool skips autoresolved' '\n \n test_expect_success 'mergetool merges all from subdir' '\n \ttest_when_finished \"git reset --hard\" &&\n-\tgit checkout -b test$test_count &&\n+\tgit checkout -b test$test_count branch1 &&\n \ttest_config rerere.enabled false &&\n \t(\n \t\tcd subdir &&\n@@ -306,7 +306,7 @@ test_expect_success 'mergetool delete/delete conflict' '\n \n test_expect_success 'mergetool produces no errors when keepBackup is used' '\n \ttest_when_finished \"git reset --hard HEAD\" &&\n-\tgit checkout -b test$test_count &&\n+\tgit checkout -b test$test_count move-to-c &&\n \ttest_config mergetool.keepBackup true &&\n \ttest_must_fail git merge move-to-b &&\n \t: >expect &&\n@@ -317,7 +317,7 @@ test_expect_success 'mergetool produces no errors when keepBackup is used' '\n \n test_expect_success 'mergetool honors tempfile config for deleted files' '\n \ttest_when_finished \"git reset --hard HEAD\" &&\n-\tgit checkout -b test$test_count &&\n+\tgit checkout -b test$test_count move-to-c &&\n \ttest_config mergetool.keepTemporaries false &&\n \ttest_must_fail git merge move-to-b &&\n \techo d | git mergetool a/a/file.txt &&\n@@ -327,7 +327,7 @@ test_expect_success 'mergetool honors tempfile config for deleted files' '\n test_expect_success 'mergetool keeps tempfiles when aborting delete/delete' '\n \ttest_when_finished \"git reset --hard HEAD\" &&\n \ttest_when_finished \"git clean -fdx\" &&\n-\tgit checkout -b test$test_count &&\n+\tgit checkout -b test$test_count move-to-c &&\n \ttest_config mergetool.keepTemporaries true &&\n \ttest_must_fail git merge move-to-b &&\n \t! (echo a; echo n) | git mergetool a/a/file.txt &&\n@@ -663,7 +663,7 @@ test_expect_success 'diff.orderFile configuration is honored' '\n '\n test_expect_success 'mergetool -Oorder-file is honored' '\n \ttest_when_finished \"git reset --hard >/dev/null 2>&1\" &&\n-\tgit checkout -b test$test_count &&\n+\tgit checkout -b test$test_count order-file-side2 &&\n \ttest_config diff.orderFile order-file &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n \ttest_config mergetool.myecho.trustExitCode true &&\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"309168","messageId":"20170110204202.21779-13-hansenr@google.com","threadId":"44811","inReplyTo":"20170110204202.21779-1-hansenr@google.com","subject":"[PATCH v5 12/14] t7610: add test case for rerere+mergetool+subdir bug","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-10T20:42:00Z","receivedAt":"2017-01-10T20:43:09Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"If rerere is enabled and mergetool is run from a subdirectory,\nmergetool always prints \"No files need merging\".  Add an expected\nfailure test case for this situation.\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n t/t7610-mergetool.sh | 21 ++++++++++++++++++++-\n 1 file changed, 20 insertions(+), 1 deletion(-)\n\ndiff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh\nindex c031ecd9e..b36fde1c0 100755\n--- a/t/t7610-mergetool.sh\n+++ b/t/t7610-mergetool.sh\n@@ -216,7 +216,7 @@ test_expect_success 'mergetool skips autoresolved' '\n \ttest \"$output\" = \"No files need merging\"\n '\n \n-test_expect_success 'mergetool merges all from subdir' '\n+test_expect_success 'mergetool merges all from subdir (rerere disabled)' '\n \ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \ttest_config rerere.enabled false &&\n@@ -234,6 +234,25 @@ test_expect_success 'mergetool merges all from subdir' '\n \t)\n '\n \n+test_expect_failure 'mergetool merges all from subdir (rerere enabled)' '\n+\ttest_when_finished \"git reset --hard\" &&\n+\tgit checkout -b test$test_count branch1 &&\n+\ttest_config rerere.enabled true &&\n+\trm -rf .git/rr-cache &&\n+\t(\n+\t\tcd subdir &&\n+\t\ttest_must_fail git merge master &&\n+\t\t( yes \"r\" | git mergetool ../submod ) &&\n+\t\t( yes \"d\" \"d\" | git mergetool --no-prompt ) &&\n+\t\ttest \"$(cat ../file1)\" = \"master updated\" &&\n+\t\ttest \"$(cat ../file2)\" = \"master new\" &&\n+\t\ttest \"$(cat file3)\" = \"master new sub\" &&\n+\t\t( cd .. && git submodule update -N ) &&\n+\t\ttest \"$(cat ../submod/bar)\" = \"master submodule\" &&\n+\t\tgit commit -m \"branch2 resolved by mergetool from subdir\"\n+\t)\n+'\n+\n test_expect_success 'mergetool skips resolved paths when rerere is active' '\n \ttest_when_finished \"git reset --hard\" &&\n \ttest_config rerere.enabled true &&\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"309169","messageId":"20170110204202.21779-14-hansenr@google.com","threadId":"44811","inReplyTo":"20170110204202.21779-1-hansenr@google.com","subject":"[PATCH v5 13/14] mergetool: take the \"-O\" out of $orderfile","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-10T20:42:01Z","receivedAt":"2017-01-10T20:43:12Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"This will make it easier for a future commit to convert a relative\norderfile pathname to either absolute or relative to the top-level\ndirectory.  It also improves code readability.\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n git-mergetool.sh | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/git-mergetool.sh b/git-mergetool.sh\nindex e52b4e4f2..b506896dc 100755\n--- a/git-mergetool.sh\n+++ b/git-mergetool.sh\n@@ -421,7 +421,7 @@ main () {\n \t\t\tprompt=true\n \t\t\t;;\n \t\t-O*)\n-\t\t\torderfile=\"$1\"\n+\t\t\torderfile=\"${1#-O}\"\n \t\t\t;;\n \t\t--)\n \t\t\tshift\n@@ -465,7 +465,7 @@ main () {\n \n \tfiles=$(git -c core.quotePath=false \\\n \t\tdiff --name-only --diff-filter=U \\\n-\t\t${orderfile:+\"$orderfile\"} -- \"$@\")\n+\t\t${orderfile:+\"-O$orderfile\"} -- \"$@\")\n \n \tcd_to_toplevel\n \n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"309170","messageId":"20170110204202.21779-15-hansenr@google.com","threadId":"44811","inReplyTo":"20170110204202.21779-1-hansenr@google.com","subject":"[PATCH v5 14/14] mergetool: fix running in subdir when rerere enabled","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-10T20:42:02Z","receivedAt":"2017-01-10T20:43:16Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"The pathnames output by the 'git rerere remaining' command are\nrelative to the top-level directory but the 'git diff --name-only'\ncommand expects its pathname arguments to be relative to the current\nworking directory.  Run cd_to_toplevel before running 'git diff\n--name-only' and adjust any relative pathnames so that 'git mergetool'\ndoes not fail when run from a subdirectory with rerere enabled.\n\nThis fixes a regression introduced in\n57937f70a09c12ef484c290865dac4066d207c9c (v2.11.0).\n\nBased-on-patch-by: Junio C Hamano <gitster@pobox.com>\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n git-mergetool.sh     | 17 +++++++++++++++--\n t/t7610-mergetool.sh |  7 ++++++-\n 2 files changed, 21 insertions(+), 3 deletions(-)\n\ndiff --git a/git-mergetool.sh b/git-mergetool.sh\nindex b506896dc..c062e3de3 100755\n--- a/git-mergetool.sh\n+++ b/git-mergetool.sh\n@@ -454,6 +454,17 @@ main () {\n \tmerge_keep_backup=\"$(git config --bool mergetool.keepBackup || echo true)\"\n \tmerge_keep_temporaries=\"$(git config --bool mergetool.keepTemporaries || echo false)\"\n \n+\tprefix=$(git rev-parse --show-prefix) || exit 1\n+\tcd_to_toplevel\n+\n+\tif test -n \"$orderfile\"\n+\tthen\n+\t\torderfile=$(\n+\t\t\tgit rev-parse --prefix \"$prefix\" -- \"$orderfile\" |\n+\t\t\tsed -e 1d\n+\t\t)\n+\tfi\n+\n \tif test $# -eq 0 && test -e \"$GIT_DIR/MERGE_RR\"\n \tthen\n \t\tset -- $(git rerere remaining)\n@@ -461,14 +472,16 @@ main () {\n \t\tthen\n \t\t\tprint_noop_and_exit\n \t\tfi\n+\telif test $# -ge 0\n+\tthen\n+\t\t# rev-parse provides the -- needed for 'set'\n+\t\teval \"set $(git rev-parse --sq --prefix \"$prefix\" -- \"$@\")\"\n \tfi\n \n \tfiles=$(git -c core.quotePath=false \\\n \t\tdiff --name-only --diff-filter=U \\\n \t\t${orderfile:+\"-O$orderfile\"} -- \"$@\")\n \n-\tcd_to_toplevel\n-\n \tif test -z \"$files\"\n \tthen\n \t\tprint_noop_and_exit\ndiff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh\nindex b36fde1c0..820fc8597 100755\n--- a/t/t7610-mergetool.sh\n+++ b/t/t7610-mergetool.sh\n@@ -234,7 +234,7 @@ test_expect_success 'mergetool merges all from subdir (rerere disabled)' '\n \t)\n '\n \n-test_expect_failure 'mergetool merges all from subdir (rerere enabled)' '\n+test_expect_success 'mergetool merges all from subdir (rerere enabled)' '\n \ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \ttest_config rerere.enabled true &&\n@@ -677,6 +677,11 @@ test_expect_success 'diff.orderFile configuration is honored' '\n \t\tb\n \t\ta\n \tEOF\n+\n+\t# make sure \"order-file\" that is ambiguous between\n+\t# rev and path is understood correctly.\n+\tgit branch order-file HEAD &&\n+\n \tgit mergetool --no-prompt --tool myecho >output &&\n \tgit grep --no-index -h -A2 Merging: output >actual &&\n \ttest_cmp expect actual\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"309171","messageId":"20170110204202.21779-9-hansenr@google.com","threadId":"44811","inReplyTo":"20170110204202.21779-1-hansenr@google.com","subject":"[PATCH v5 08/14] t7610: delete some now-unnecessary 'git reset --hard' lines","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-10T20:41:56Z","receivedAt":"2017-01-10T20:43:23Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"Tests now always run 'git reset --hard' at the end (even if they\nfail), so it's no longer necessary to run 'git reset --hard' at the\nbeginning of a test.\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n t/t7610-mergetool.sh | 2 --\n 1 file changed, 2 deletions(-)\n\ndiff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh\nindex 55587504e..7d5e1df88 100755\n--- a/t/t7610-mergetool.sh\n+++ b/t/t7610-mergetool.sh\n@@ -184,7 +184,6 @@ test_expect_success 'mergetool in subdir' '\n \n test_expect_success 'mergetool on file in parent dir' '\n \ttest_when_finished \"git reset --hard\" &&\n-\tgit reset --hard &&\n \tgit submodule update -N &&\n \t(\n \t\tcd subdir &&\n@@ -277,7 +276,6 @@ test_expect_success 'conflicted stash sets up rerere'  '\n \n test_expect_success 'mergetool takes partial path' '\n \ttest_when_finished \"git reset --hard\" &&\n-\tgit reset --hard &&\n \ttest_config rerere.enabled false &&\n \tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"309172","messageId":"20170110204202.21779-8-hansenr@google.com","threadId":"44811","inReplyTo":"20170110204202.21779-1-hansenr@google.com","subject":"[PATCH v5 07/14] t7610: run 'git reset --hard' after each test to clean up","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-10T20:41:55Z","receivedAt":"2017-01-10T20:43:25Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"Use test_when_finished to run 'git reset --hard' after each test so\nthat the repository is left in a saner state for the next test.\n\nThis is a step toward making the tests more independent so that if one\ntest fails it doesn't cause subsequent tests to fail.\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n t/t7610-mergetool.sh | 8 ++++++++\n 1 file changed, 8 insertions(+)\n\ndiff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh\nindex 2d92a2646..55587504e 100755\n--- a/t/t7610-mergetool.sh\n+++ b/t/t7610-mergetool.sh\n@@ -127,6 +127,7 @@ test_expect_success 'setup' '\n '\n \n test_expect_success 'custom mergetool' '\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \ttest_must_fail git merge master >/dev/null 2>&1 &&\n@@ -170,6 +171,7 @@ test_expect_success 'mergetool crlf' '\n '\n \n test_expect_success 'mergetool in subdir' '\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \t(\n@@ -181,6 +183,7 @@ test_expect_success 'mergetool in subdir' '\n '\n \n test_expect_success 'mergetool on file in parent dir' '\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit reset --hard &&\n \tgit submodule update -N &&\n \t(\n@@ -214,6 +217,7 @@ test_expect_success 'mergetool skips autoresolved' '\n '\n \n test_expect_success 'mergetool merges all from subdir' '\n+\ttest_when_finished \"git reset --hard\" &&\n \ttest_config rerere.enabled false &&\n \t(\n \t\tcd subdir &&\n@@ -244,6 +248,7 @@ test_expect_success 'mergetool skips resolved paths when rerere is active' '\n '\n \n test_expect_success 'conflicted stash sets up rerere'  '\n+\ttest_when_finished \"git reset --hard\" &&\n \ttest_config rerere.enabled true &&\n \tgit checkout stash1 &&\n \techo \"Conflicting stash content\" >file11 &&\n@@ -403,6 +408,7 @@ test_expect_success 'deleted vs modified submodule' '\n '\n \n test_expect_success 'file vs modified submodule' '\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \tmv submod submod-movedaside &&\n@@ -474,6 +480,7 @@ test_expect_success 'file vs modified submodule' '\n '\n \n test_expect_success 'submodule in subdirectory' '\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \t(\n@@ -535,6 +542,7 @@ test_expect_success 'submodule in subdirectory' '\n '\n \n test_expect_success 'directory vs modified submodule' '\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \tmv submod submod-movedaside &&\n \tgit rm --cached submod &&\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"309173","messageId":"20170110204202.21779-7-hansenr@google.com","threadId":"44811","inReplyTo":"20170110204202.21779-1-hansenr@google.com","subject":"[PATCH v5 06/14] t7610: don't rely on state from previous test","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-10T20:41:54Z","receivedAt":"2017-01-10T20:43:26Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"If the repository must be in a particular state (beyond what is\nalready done by the 'setup' test case) before the test can run, make\nthe necessary repository changes in the test script even if it means\nduplicating some lines of code from the previous test case.\n\nThis is a step toward making the tests more independent so that if one\ntest fails it doesn't cause subsequent tests to fail.\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n t/t7610-mergetool.sh | 6 ++++++\n 1 file changed, 6 insertions(+)\n\ndiff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh\nindex f62ceffdc..2d92a2646 100755\n--- a/t/t7610-mergetool.sh\n+++ b/t/t7610-mergetool.sh\n@@ -181,8 +181,12 @@ test_expect_success 'mergetool in subdir' '\n '\n \n test_expect_success 'mergetool on file in parent dir' '\n+\tgit reset --hard &&\n+\tgit submodule update -N &&\n \t(\n \t\tcd subdir &&\n+\t\ttest_must_fail git merge master >/dev/null 2>&1 &&\n+\t\t( yes \"\" | git mergetool file3 >/dev/null 2>&1 ) &&\n \t\t( yes \"\" | git mergetool ../file1 >/dev/null 2>&1 ) &&\n \t\t( yes \"\" | git mergetool ../file2 ../spaced\\ name >/dev/null 2>&1 ) &&\n \t\t( yes \"\" | git mergetool ../both >/dev/null 2>&1 ) &&\n@@ -651,6 +655,8 @@ test_expect_success 'mergetool -Oorder-file is honored' '\n \ttest_config diff.orderFile order-file &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n \ttest_config mergetool.myecho.trustExitCode true &&\n+\techo b >order-file &&\n+\techo a >>order-file &&\n \ttest_must_fail git merge order-file-side1 &&\n \tcat >expect <<-\\EOF &&\n \t\tMerging:\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"309174","messageId":"20170110204202.21779-6-hansenr@google.com","threadId":"44811","inReplyTo":"20170110204202.21779-1-hansenr@google.com","subject":"[PATCH v5 05/14] t7610: use test_when_finished for cleanup tasks","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-10T20:41:53Z","receivedAt":"2017-01-10T20:43:30Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"This is a step toward making the tests more independent so that if one\ntest fails it doesn't cause subsequent tests to fail.\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n t/t7610-mergetool.sh | 71 +++++++++++++++++++++++++++-------------------------\n 1 file changed, 37 insertions(+), 34 deletions(-)\n\ndiff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh\nindex 550838a1c..f62ceffdc 100755\n--- a/t/t7610-mergetool.sh\n+++ b/t/t7610-mergetool.sh\n@@ -145,6 +145,11 @@ test_expect_success 'custom mergetool' '\n '\n \n test_expect_success 'mergetool crlf' '\n+\ttest_when_finished \"git reset --hard\" &&\n+\t# This test_config line must go after the above reset line so that\n+\t# core.autocrlf is unconfigured before reset runs.  (The\n+\t# test_config command uses test_when_finished internally and\n+\t# test_when_finished is LIFO.)\n \ttest_config core.autocrlf true &&\n \tgit checkout -b test$test_count branch1 &&\n \ttest_must_fail git merge master >/dev/null 2>&1 &&\n@@ -161,9 +166,7 @@ test_expect_success 'mergetool crlf' '\n \ttest \"$(printf x | cat subdir/file3 -)\" = \"$(printf \"master new sub\\r\\nx\")\" &&\n \tgit submodule update -N &&\n \ttest \"$(cat submod/bar)\" = \"master submodule\" &&\n-\tgit commit -m \"branch1 resolved with mergetool - autocrlf\" &&\n-\ttest_config core.autocrlf false &&\n-\tgit reset --hard\n+\tgit commit -m \"branch1 resolved with mergetool - autocrlf\"\n '\n \n test_expect_success 'mergetool in subdir' '\n@@ -194,6 +197,7 @@ test_expect_success 'mergetool on file in parent dir' '\n '\n \n test_expect_success 'mergetool skips autoresolved' '\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \ttest_must_fail git merge master &&\n@@ -202,8 +206,7 @@ test_expect_success 'mergetool skips autoresolved' '\n \t( yes \"d\" | git mergetool file12 >/dev/null 2>&1 ) &&\n \t( yes \"l\" | git mergetool submod >/dev/null 2>&1 ) &&\n \toutput=\"$(git mergetool --no-prompt)\" &&\n-\ttest \"$output\" = \"No files need merging\" &&\n-\tgit reset --hard\n+\ttest \"$output\" = \"No files need merging\"\n '\n \n test_expect_success 'mergetool merges all from subdir' '\n@@ -223,6 +226,7 @@ test_expect_success 'mergetool merges all from subdir' '\n '\n \n test_expect_success 'mergetool skips resolved paths when rerere is active' '\n+\ttest_when_finished \"git reset --hard\" &&\n \ttest_config rerere.enabled true &&\n \trm -rf .git/rr-cache &&\n \tgit checkout -b test$test_count branch1 &&\n@@ -232,8 +236,7 @@ test_expect_success 'mergetool skips resolved paths when rerere is active' '\n \t( yes \"d\" \"d\" | git mergetool --no-prompt >/dev/null 2>&1 ) &&\n \tgit submodule update -N &&\n \toutput=\"$(yes \"n\" | git mergetool --no-prompt)\" &&\n-\ttest \"$output\" = \"No files need merging\" &&\n-\tgit reset --hard\n+\ttest \"$output\" = \"No files need merging\"\n '\n \n test_expect_success 'conflicted stash sets up rerere'  '\n@@ -264,6 +267,7 @@ test_expect_success 'conflicted stash sets up rerere'  '\n '\n \n test_expect_success 'mergetool takes partial path' '\n+\ttest_when_finished \"git reset --hard\" &&\n \tgit reset --hard &&\n \ttest_config rerere.enabled false &&\n \tgit checkout -b test$test_count branch1 &&\n@@ -272,11 +276,11 @@ test_expect_success 'mergetool takes partial path' '\n \n \t( yes \"\" | git mergetool subdir ) &&\n \n-\ttest \"$(cat subdir/file3)\" = \"master new sub\" &&\n-\tgit reset --hard\n+\ttest \"$(cat subdir/file3)\" = \"master new sub\"\n '\n \n test_expect_success 'mergetool delete/delete conflict' '\n+\ttest_when_finished \"git reset --hard HEAD\" &&\n \tgit checkout move-to-c &&\n \ttest_must_fail git merge move-to-b &&\n \techo d | git mergetool a/a/file.txt &&\n@@ -288,29 +292,30 @@ test_expect_success 'mergetool delete/delete conflict' '\n \tgit reset --hard HEAD &&\n \ttest_must_fail git merge move-to-b &&\n \t! echo a | git mergetool a/a/file.txt &&\n-\t! test -f a/a/file.txt &&\n-\tgit reset --hard HEAD\n+\t! test -f a/a/file.txt\n '\n \n test_expect_success 'mergetool produces no errors when keepBackup is used' '\n+\ttest_when_finished \"git reset --hard HEAD\" &&\n \ttest_config mergetool.keepBackup true &&\n \ttest_must_fail git merge move-to-b &&\n \t: >expect &&\n \techo d | git mergetool a/a/file.txt 2>actual &&\n \ttest_cmp expect actual &&\n-\t! test -d a &&\n-\tgit reset --hard HEAD\n+\t! test -d a\n '\n \n test_expect_success 'mergetool honors tempfile config for deleted files' '\n+\ttest_when_finished \"git reset --hard HEAD\" &&\n \ttest_config mergetool.keepTemporaries false &&\n \ttest_must_fail git merge move-to-b &&\n \techo d | git mergetool a/a/file.txt &&\n-\t! test -d a &&\n-\tgit reset --hard HEAD\n+\t! test -d a\n '\n \n test_expect_success 'mergetool keeps tempfiles when aborting delete/delete' '\n+\ttest_when_finished \"git reset --hard HEAD\" &&\n+\ttest_when_finished \"git clean -fdx\" &&\n \ttest_config mergetool.keepTemporaries true &&\n \ttest_must_fail git merge move-to-b &&\n \t! (echo a; echo n) | git mergetool a/a/file.txt &&\n@@ -321,12 +326,11 @@ test_expect_success 'mergetool keeps tempfiles when aborting delete/delete' '\n \tfile_REMOTE_.txt\n \tEOF\n \tls -1 a/a | sed -e \"s/[0-9]*//g\" >actual &&\n-\ttest_cmp expect actual &&\n-\tgit clean -fdx &&\n-\tgit reset --hard HEAD\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'deleted vs modified submodule' '\n+\ttest_when_finished \"git reset --hard HEAD\" &&\n \tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \tmv submod submod-movedaside &&\n@@ -391,8 +395,7 @@ test_expect_success 'deleted vs modified submodule' '\n \ttest \"$(cat submod/bar)\" = \"master submodule\" &&\n \toutput=\"$(git mergetool --no-prompt)\" &&\n \ttest \"$output\" = \"No files need merging\" &&\n-\tgit commit -m \"Merge resolved by keeping module\" &&\n-\tgit reset --hard HEAD\n+\tgit commit -m \"Merge resolved by keeping module\"\n '\n \n test_expect_success 'file vs modified submodule' '\n@@ -479,6 +482,7 @@ test_expect_success 'submodule in subdirectory' '\n \t\tgit commit -m \"add initial versions\"\n \t\t)\n \t) &&\n+\ttest_when_finished \"rm -rf subdir/subdir_module\" &&\n \tgit submodule add git://example.com/subsubmodule subdir/subdir_module &&\n \tgit add subdir/subdir_module &&\n \tgit commit -m \"add submodule in subdirectory\" &&\n@@ -523,8 +527,7 @@ test_expect_success 'submodule in subdirectory' '\n \ttest \"$(cat subdir/subdir_module/file15)\" = \"test$test_count.b\" &&\n \tgit submodule update -N &&\n \ttest \"$(cat subdir/subdir_module/file15)\" = \"test$test_count.a\" &&\n-\tgit commit -m \"branch1 resolved with mergetool\" &&\n-\trm -rf subdir/subdir_module\n+\tgit commit -m \"branch1 resolved with mergetool\"\n '\n \n test_expect_success 'directory vs modified submodule' '\n@@ -578,34 +581,34 @@ test_expect_success 'directory vs modified submodule' '\n '\n \n test_expect_success 'file with no base' '\n+\ttest_when_finished \"git reset --hard master >/dev/null 2>&1\" &&\n \tgit checkout -b test$test_count branch1 &&\n \ttest_must_fail git merge master &&\n \tgit mergetool --no-prompt --tool mybase -- both &&\n \t>expected &&\n-\ttest_cmp both expected &&\n-\tgit reset --hard master >/dev/null 2>&1\n+\ttest_cmp both expected\n '\n \n test_expect_success 'custom commands override built-ins' '\n+\ttest_when_finished \"git reset --hard master >/dev/null 2>&1\" &&\n \tgit checkout -b test$test_count branch1 &&\n \ttest_config mergetool.defaults.cmd \"cat \\\"\\$REMOTE\\\" >\\\"\\$MERGED\\\"\" &&\n \ttest_config mergetool.defaults.trustExitCode true &&\n \ttest_must_fail git merge master &&\n \tgit mergetool --no-prompt --tool defaults -- both &&\n \techo master both added >expected &&\n-\ttest_cmp both expected &&\n-\tgit reset --hard master >/dev/null 2>&1\n+\ttest_cmp both expected\n '\n \n test_expect_success 'filenames seen by tools start with ./' '\n+\ttest_when_finished \"git reset --hard master >/dev/null 2>&1\" &&\n \tgit checkout -b test$test_count branch1 &&\n \ttest_config mergetool.writeToTemp false &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n \ttest_config mergetool.myecho.trustExitCode true &&\n \ttest_must_fail git merge master &&\n \tgit mergetool --no-prompt --tool myecho -- both >actual &&\n-\tgrep ^\\./both_LOCAL_ actual >/dev/null &&\n-\tgit reset --hard master >/dev/null 2>&1\n+\tgrep ^\\./both_LOCAL_ actual >/dev/null\n '\n \n test_lazy_prereq MKTEMP '\n@@ -614,6 +617,7 @@ test_lazy_prereq MKTEMP '\n '\n \n test_expect_success MKTEMP 'temporary filenames are used with mergetool.writeToTemp' '\n+\ttest_when_finished \"git reset --hard master >/dev/null 2>&1\" &&\n \tgit checkout -b test$test_count branch1 &&\n \ttest_config mergetool.writeToTemp true &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n@@ -621,11 +625,11 @@ test_expect_success MKTEMP 'temporary filenames are used with mergetool.writeToT\n \ttest_must_fail git merge master &&\n \tgit mergetool --no-prompt --tool myecho -- both >actual &&\n \ttest_must_fail grep ^\\./both_LOCAL_ actual >/dev/null &&\n-\tgrep /both_LOCAL_ actual >/dev/null &&\n-\tgit reset --hard master >/dev/null 2>&1\n+\tgrep /both_LOCAL_ actual >/dev/null\n '\n \n test_expect_success 'diff.orderFile configuration is honored' '\n+\ttest_when_finished \"git reset --hard >/dev/null\" &&\n \tgit checkout order-file-side2 &&\n \ttest_config diff.orderFile order-file &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n@@ -640,10 +644,10 @@ test_expect_success 'diff.orderFile configuration is honored' '\n \tEOF\n \tgit mergetool --no-prompt --tool myecho >output &&\n \tgit grep --no-index -h -A2 Merging: output >actual &&\n-\ttest_cmp expect actual &&\n-\tgit reset --hard >/dev/null\n+\ttest_cmp expect actual\n '\n test_expect_success 'mergetool -Oorder-file is honored' '\n+\ttest_when_finished \"git reset --hard >/dev/null 2>&1\" &&\n \ttest_config diff.orderFile order-file &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n \ttest_config mergetool.myecho.trustExitCode true &&\n@@ -667,8 +671,7 @@ test_expect_success 'mergetool -Oorder-file is honored' '\n \tEOF\n \tgit mergetool -Oorder-file --no-prompt --tool myecho >output &&\n \tgit grep --no-index -h -A2 Merging: output >actual &&\n-\ttest_cmp expect actual &&\n-\tgit reset --hard >/dev/null 2>&1\n+\ttest_cmp expect actual\n '\n \n test_done\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"309175","messageId":"20170110204202.21779-5-hansenr@google.com","threadId":"44811","inReplyTo":"20170110204202.21779-1-hansenr@google.com","subject":"[PATCH v5 04/14] t7610: Move setup code to the 'setup' test case.","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-10T20:41:52Z","receivedAt":"2017-01-10T20:43:34Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"Multiple test cases depend on these hunks, so move them to the 'setup'\ntest case.  This is a step toward making the tests more independent so\nthat if one test fails it doesn't cause subsequent tests to fail.\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n t/t7610-mergetool.sh | 65 ++++++++++++++++++++++++++++------------------------\n 1 file changed, 35 insertions(+), 30 deletions(-)\n\ndiff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh\nindex 14090739f..550838a1c 100755\n--- a/t/t7610-mergetool.sh\n+++ b/t/t7610-mergetool.sh\n@@ -55,6 +55,22 @@ test_expect_success 'setup' '\n \tgit rm file12 &&\n \tgit commit -m \"branch1 changes\" &&\n \n+\tgit checkout -b delete-base branch1 &&\n+\tmkdir -p a/a &&\n+\t(echo one; echo two; echo 3; echo 4) >a/a/file.txt &&\n+\tgit add a/a/file.txt &&\n+\tgit commit -m\"base file\" &&\n+\tgit checkout -b move-to-b delete-base &&\n+\tmkdir -p b/b &&\n+\tgit mv a/a/file.txt b/b/file.txt &&\n+\t(echo one; echo two; echo 4) >b/b/file.txt &&\n+\tgit commit -a -m\"move to b\" &&\n+\tgit checkout -b move-to-c delete-base &&\n+\tmkdir -p c/c &&\n+\tgit mv a/a/file.txt c/c/file.txt &&\n+\t(echo one; echo two; echo 3) >c/c/file.txt &&\n+\tgit commit -a -m\"move to c\" &&\n+\n \tgit checkout -b stash1 master &&\n \techo stash1 change file11 >file11 &&\n \tgit add file11 &&\n@@ -86,6 +102,23 @@ test_expect_success 'setup' '\n \tgit rm file11 &&\n \tgit commit -m \"master updates\" &&\n \n+\tgit clean -fdx &&\n+\tgit checkout -b order-file-start master &&\n+\techo start >a &&\n+\techo start >b &&\n+\tgit add a b &&\n+\tgit commit -m start &&\n+\tgit checkout -b order-file-side1 order-file-start &&\n+\techo side1 >a &&\n+\techo side1 >b &&\n+\tgit add a b &&\n+\tgit commit -m side1 &&\n+\tgit checkout -b order-file-side2 order-file-start &&\n+\techo side2 >a &&\n+\techo side2 >b &&\n+\tgit add a b &&\n+\tgit commit -m side2 &&\n+\n \tgit config merge.tool mytool &&\n \tgit config mergetool.mytool.cmd \"cat \\\"\\$REMOTE\\\" >\\\"\\$MERGED\\\"\" &&\n \tgit config mergetool.mytool.trustExitCode true &&\n@@ -244,21 +277,7 @@ test_expect_success 'mergetool takes partial path' '\n '\n \n test_expect_success 'mergetool delete/delete conflict' '\n-\tgit checkout -b delete-base branch1 &&\n-\tmkdir -p a/a &&\n-\t(echo one; echo two; echo 3; echo 4) >a/a/file.txt &&\n-\tgit add a/a/file.txt &&\n-\tgit commit -m\"base file\" &&\n-\tgit checkout -b move-to-b delete-base &&\n-\tmkdir -p b/b &&\n-\tgit mv a/a/file.txt b/b/file.txt &&\n-\t(echo one; echo two; echo 4) >b/b/file.txt &&\n-\tgit commit -a -m\"move to b\" &&\n-\tgit checkout -b move-to-c delete-base &&\n-\tmkdir -p c/c &&\n-\tgit mv a/a/file.txt c/c/file.txt &&\n-\t(echo one; echo two; echo 3) >c/c/file.txt &&\n-\tgit commit -a -m\"move to c\" &&\n+\tgit checkout move-to-c &&\n \ttest_must_fail git merge move-to-b &&\n \techo d | git mergetool a/a/file.txt &&\n \t! test -f a/a/file.txt &&\n@@ -607,26 +626,12 @@ test_expect_success MKTEMP 'temporary filenames are used with mergetool.writeToT\n '\n \n test_expect_success 'diff.orderFile configuration is honored' '\n+\tgit checkout order-file-side2 &&\n \ttest_config diff.orderFile order-file &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n \ttest_config mergetool.myecho.trustExitCode true &&\n \techo b >order-file &&\n \techo a >>order-file &&\n-\tgit checkout -b order-file-start master &&\n-\techo start >a &&\n-\techo start >b &&\n-\tgit add a b &&\n-\tgit commit -m start &&\n-\tgit checkout -b order-file-side1 order-file-start &&\n-\techo side1 >a &&\n-\techo side1 >b &&\n-\tgit add a b &&\n-\tgit commit -m side1 &&\n-\tgit checkout -b order-file-side2 order-file-start &&\n-\techo side2 >a &&\n-\techo side2 >b &&\n-\tgit add a b &&\n-\tgit commit -m side2 &&\n \ttest_must_fail git merge order-file-side1 &&\n \tcat >expect <<-\\EOF &&\n \t\tMerging:\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"309176","messageId":"20170110204202.21779-4-hansenr@google.com","threadId":"44811","inReplyTo":"20170110204202.21779-1-hansenr@google.com","subject":"[PATCH v5 03/14] t7610: update branch names to match test number","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-10T20:41:51Z","receivedAt":"2017-01-10T20:43:35Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"Rename the testNN branches so that NN matches the test number.  This\nshould make it easier to troubleshoot test issues.  Use $test_count to\nkeep this future-proof.\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n t/t7610-mergetool.sh | 82 ++++++++++++++++++++++++++--------------------------\n 1 file changed, 41 insertions(+), 41 deletions(-)\n\ndiff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh\nindex 6d9f21511..14090739f 100755\n--- a/t/t7610-mergetool.sh\n+++ b/t/t7610-mergetool.sh\n@@ -94,7 +94,7 @@ test_expect_success 'setup' '\n '\n \n test_expect_success 'custom mergetool' '\n-\tgit checkout -b test1 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \ttest_must_fail git merge master >/dev/null 2>&1 &&\n \t( yes \"\" | git mergetool both >/dev/null 2>&1 ) &&\n@@ -113,7 +113,7 @@ test_expect_success 'custom mergetool' '\n \n test_expect_success 'mergetool crlf' '\n \ttest_config core.autocrlf true &&\n-\tgit checkout -b test2 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \ttest_must_fail git merge master >/dev/null 2>&1 &&\n \t( yes \"\" | git mergetool file1 >/dev/null 2>&1 ) &&\n \t( yes \"\" | git mergetool file2 >/dev/null 2>&1 ) &&\n@@ -134,7 +134,7 @@ test_expect_success 'mergetool crlf' '\n '\n \n test_expect_success 'mergetool in subdir' '\n-\tgit checkout -b test3 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \t(\n \t\tcd subdir &&\n@@ -161,7 +161,7 @@ test_expect_success 'mergetool on file in parent dir' '\n '\n \n test_expect_success 'mergetool skips autoresolved' '\n-\tgit checkout -b test4 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \ttest_must_fail git merge master &&\n \ttest -n \"$(git ls-files -u)\" &&\n@@ -192,7 +192,7 @@ test_expect_success 'mergetool merges all from subdir' '\n test_expect_success 'mergetool skips resolved paths when rerere is active' '\n \ttest_config rerere.enabled true &&\n \trm -rf .git/rr-cache &&\n-\tgit checkout -b test5 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \ttest_must_fail git merge master >/dev/null 2>&1 &&\n \t( yes \"l\" | git mergetool --no-prompt submod >/dev/null 2>&1 ) &&\n@@ -233,7 +233,7 @@ test_expect_success 'conflicted stash sets up rerere'  '\n test_expect_success 'mergetool takes partial path' '\n \tgit reset --hard &&\n \ttest_config rerere.enabled false &&\n-\tgit checkout -b test12 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \ttest_must_fail git merge master &&\n \n@@ -308,12 +308,12 @@ test_expect_success 'mergetool keeps tempfiles when aborting delete/delete' '\n '\n \n test_expect_success 'deleted vs modified submodule' '\n-\tgit checkout -b test6 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \tmv submod submod-movedaside &&\n \tgit rm --cached submod &&\n \tgit commit -m \"Submodule deleted from branch\" &&\n-\tgit checkout -b test6.a test6 &&\n+\tgit checkout -b test$test_count.a test$test_count &&\n \ttest_must_fail git merge master &&\n \ttest -n \"$(git ls-files -u)\" &&\n \t( yes \"\" | git mergetool file1 file2 spaced\\ name subdir/file3 >/dev/null 2>&1 ) &&\n@@ -329,7 +329,7 @@ test_expect_success 'deleted vs modified submodule' '\n \tgit commit -m \"Merge resolved by keeping module\" &&\n \n \tmv submod submod-movedaside &&\n-\tgit checkout -b test6.b test6 &&\n+\tgit checkout -b test$test_count.b test$test_count &&\n \tgit submodule update -N &&\n \ttest_must_fail git merge master &&\n \ttest -n \"$(git ls-files -u)\" &&\n@@ -343,9 +343,9 @@ test_expect_success 'deleted vs modified submodule' '\n \tgit commit -m \"Merge resolved by deleting module\" &&\n \n \tmv submod-movedaside submod &&\n-\tgit checkout -b test6.c master &&\n+\tgit checkout -b test$test_count.c master &&\n \tgit submodule update -N &&\n-\ttest_must_fail git merge test6 &&\n+\ttest_must_fail git merge test$test_count &&\n \ttest -n \"$(git ls-files -u)\" &&\n \t( yes \"\" | git mergetool file1 file2 spaced\\ name subdir/file3 >/dev/null 2>&1 ) &&\n \t( yes \"\" | git mergetool both >/dev/null 2>&1 ) &&\n@@ -359,9 +359,9 @@ test_expect_success 'deleted vs modified submodule' '\n \tgit commit -m \"Merge resolved by deleting module\" &&\n \tmv submod.orig submod &&\n \n-\tgit checkout -b test6.d master &&\n+\tgit checkout -b test$test_count.d master &&\n \tgit submodule update -N &&\n-\ttest_must_fail git merge test6 &&\n+\ttest_must_fail git merge test$test_count &&\n \ttest -n \"$(git ls-files -u)\" &&\n \t( yes \"\" | git mergetool file1 file2 spaced\\ name subdir/file3 >/dev/null 2>&1 ) &&\n \t( yes \"\" | git mergetool both >/dev/null 2>&1 ) &&\n@@ -377,14 +377,14 @@ test_expect_success 'deleted vs modified submodule' '\n '\n \n test_expect_success 'file vs modified submodule' '\n-\tgit checkout -b test7 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \tmv submod submod-movedaside &&\n \tgit rm --cached submod &&\n \techo not a submodule >submod &&\n \tgit add submod &&\n \tgit commit -m \"Submodule path becomes file\" &&\n-\tgit checkout -b test7.a branch1 &&\n+\tgit checkout -b test$test_count.a branch1 &&\n \ttest_must_fail git merge master &&\n \ttest -n \"$(git ls-files -u)\" &&\n \t( yes \"\" | git mergetool file1 file2 spaced\\ name subdir/file3 >/dev/null 2>&1 ) &&\n@@ -400,7 +400,7 @@ test_expect_success 'file vs modified submodule' '\n \tgit commit -m \"Merge resolved by keeping module\" &&\n \n \tmv submod submod-movedaside &&\n-\tgit checkout -b test7.b test7 &&\n+\tgit checkout -b test$test_count.b test$test_count &&\n \ttest_must_fail git merge master &&\n \ttest -n \"$(git ls-files -u)\" &&\n \t( yes \"\" | git mergetool file1 file2 spaced\\ name subdir/file3 >/dev/null 2>&1 ) &&\n@@ -413,11 +413,11 @@ test_expect_success 'file vs modified submodule' '\n \ttest \"$output\" = \"No files need merging\" &&\n \tgit commit -m \"Merge resolved by keeping file\" &&\n \n-\tgit checkout -b test7.c master &&\n+\tgit checkout -b test$test_count.c master &&\n \trmdir submod && mv submod-movedaside submod &&\n \ttest ! -e submod.orig &&\n \tgit submodule update -N &&\n-\ttest_must_fail git merge test7 &&\n+\ttest_must_fail git merge test$test_count &&\n \ttest -n \"$(git ls-files -u)\" &&\n \t( yes \"\" | git mergetool file1 file2 spaced\\ name subdir/file3 >/dev/null 2>&1 ) &&\n \t( yes \"\" | git mergetool both >/dev/null 2>&1 ) &&\n@@ -430,10 +430,10 @@ test_expect_success 'file vs modified submodule' '\n \ttest \"$output\" = \"No files need merging\" &&\n \tgit commit -m \"Merge resolved by keeping file\" &&\n \n-\tgit checkout -b test7.d master &&\n+\tgit checkout -b test$test_count.d master &&\n \trmdir submod && mv submod.orig submod &&\n \tgit submodule update -N &&\n-\ttest_must_fail git merge test7 &&\n+\ttest_must_fail git merge test$test_count &&\n \ttest -n \"$(git ls-files -u)\" &&\n \t( yes \"\" | git mergetool file1 file2 spaced\\ name subdir/file3 >/dev/null 2>&1 ) &&\n \t( yes \"\" | git mergetool both>/dev/null 2>&1 ) &&\n@@ -448,7 +448,7 @@ test_expect_success 'file vs modified submodule' '\n '\n \n test_expect_success 'submodule in subdirectory' '\n-\tgit checkout -b test10 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \tgit submodule update -N &&\n \t(\n \t\tcd subdir &&\n@@ -464,52 +464,52 @@ test_expect_success 'submodule in subdirectory' '\n \tgit add subdir/subdir_module &&\n \tgit commit -m \"add submodule in subdirectory\" &&\n \n-\tgit checkout -b test10.a test10 &&\n+\tgit checkout -b test$test_count.a test$test_count &&\n \tgit submodule update -N &&\n \t(\n \tcd subdir/subdir_module &&\n \t\tgit checkout -b super10.a &&\n-\t\techo test10.a >file15 &&\n+\t\techo test$test_count.a >file15 &&\n \t\tgit add file15 &&\n \t\tgit commit -m \"on branch 10.a\"\n \t) &&\n \tgit add subdir/subdir_module &&\n-\tgit commit -m \"change submodule in subdirectory on test10.a\" &&\n+\tgit commit -m \"change submodule in subdirectory on test$test_count.a\" &&\n \n-\tgit checkout -b test10.b test10 &&\n+\tgit checkout -b test$test_count.b test$test_count &&\n \tgit submodule update -N &&\n \t(\n \t\tcd subdir/subdir_module &&\n \t\tgit checkout -b super10.b &&\n-\t\techo test10.b >file15 &&\n+\t\techo test$test_count.b >file15 &&\n \t\tgit add file15 &&\n \t\tgit commit -m \"on branch 10.b\"\n \t) &&\n \tgit add subdir/subdir_module &&\n-\tgit commit -m \"change submodule in subdirectory on test10.b\" &&\n+\tgit commit -m \"change submodule in subdirectory on test$test_count.b\" &&\n \n-\ttest_must_fail git merge test10.a >/dev/null 2>&1 &&\n+\ttest_must_fail git merge test$test_count.a >/dev/null 2>&1 &&\n \t(\n \t\tcd subdir &&\n \t\t( yes \"l\" | git mergetool subdir_module )\n \t) &&\n-\ttest \"$(cat subdir/subdir_module/file15)\" = \"test10.b\" &&\n+\ttest \"$(cat subdir/subdir_module/file15)\" = \"test$test_count.b\" &&\n \tgit submodule update -N &&\n-\ttest \"$(cat subdir/subdir_module/file15)\" = \"test10.b\" &&\n+\ttest \"$(cat subdir/subdir_module/file15)\" = \"test$test_count.b\" &&\n \tgit reset --hard &&\n \tgit submodule update -N &&\n \n-\ttest_must_fail git merge test10.a >/dev/null 2>&1 &&\n+\ttest_must_fail git merge test$test_count.a >/dev/null 2>&1 &&\n \t( yes \"r\" | git mergetool subdir/subdir_module ) &&\n-\ttest \"$(cat subdir/subdir_module/file15)\" = \"test10.b\" &&\n+\ttest \"$(cat subdir/subdir_module/file15)\" = \"test$test_count.b\" &&\n \tgit submodule update -N &&\n-\ttest \"$(cat subdir/subdir_module/file15)\" = \"test10.a\" &&\n+\ttest \"$(cat subdir/subdir_module/file15)\" = \"test$test_count.a\" &&\n \tgit commit -m \"branch1 resolved with mergetool\" &&\n \trm -rf subdir/subdir_module\n '\n \n test_expect_success 'directory vs modified submodule' '\n-\tgit checkout -b test11 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \tmv submod submod-movedaside &&\n \tgit rm --cached submod &&\n \tmkdir submod &&\n@@ -537,9 +537,9 @@ test_expect_success 'directory vs modified submodule' '\n \ttest \"$(cat submod/bar)\" = \"master submodule\" &&\n \tgit reset --hard >/dev/null 2>&1 && rm -rf submod-movedaside &&\n \n-\tgit checkout -b test11.c master &&\n+\tgit checkout -b test$test_count.c master &&\n \tgit submodule update -N &&\n-\ttest_must_fail git merge test11 &&\n+\ttest_must_fail git merge test$test_count &&\n \ttest -n \"$(git ls-files -u)\" &&\n \t( yes \"l\" | git mergetool submod ) &&\n \tgit submodule update -N &&\n@@ -547,7 +547,7 @@ test_expect_success 'directory vs modified submodule' '\n \n \tgit reset --hard >/dev/null 2>&1 &&\n \tgit submodule update -N &&\n-\ttest_must_fail git merge test11 &&\n+\ttest_must_fail git merge test$test_count &&\n \ttest -n \"$(git ls-files -u)\" &&\n \ttest ! -e submod.orig &&\n \t( yes \"r\" | git mergetool submod ) &&\n@@ -559,7 +559,7 @@ test_expect_success 'directory vs modified submodule' '\n '\n \n test_expect_success 'file with no base' '\n-\tgit checkout -b test13 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \ttest_must_fail git merge master &&\n \tgit mergetool --no-prompt --tool mybase -- both &&\n \t>expected &&\n@@ -568,7 +568,7 @@ test_expect_success 'file with no base' '\n '\n \n test_expect_success 'custom commands override built-ins' '\n-\tgit checkout -b test14 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \ttest_config mergetool.defaults.cmd \"cat \\\"\\$REMOTE\\\" >\\\"\\$MERGED\\\"\" &&\n \ttest_config mergetool.defaults.trustExitCode true &&\n \ttest_must_fail git merge master &&\n@@ -579,7 +579,7 @@ test_expect_success 'custom commands override built-ins' '\n '\n \n test_expect_success 'filenames seen by tools start with ./' '\n-\tgit checkout -b test15 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \ttest_config mergetool.writeToTemp false &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n \ttest_config mergetool.myecho.trustExitCode true &&\n@@ -595,7 +595,7 @@ test_lazy_prereq MKTEMP '\n '\n \n test_expect_success MKTEMP 'temporary filenames are used with mergetool.writeToTemp' '\n-\tgit checkout -b test16 branch1 &&\n+\tgit checkout -b test$test_count branch1 &&\n \ttest_config mergetool.writeToTemp true &&\n \ttest_config mergetool.myecho.cmd \"echo \\\"\\$LOCAL\\\"\" &&\n \ttest_config mergetool.myecho.trustExitCode true &&\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"309177","messageId":"20170110204202.21779-3-hansenr@google.com","threadId":"44811","inReplyTo":"20170110204202.21779-1-hansenr@google.com","subject":"[PATCH v5 02/14] rev-parse doc: pass \"--\" to rev-parse in the --prefix example","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-10T20:41:50Z","receivedAt":"2017-01-10T20:43:38Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"The \"--\" argument avoids \"ambiguous argument: unknown revision or\npath not in the working tree\" errors when a pathname argument refers\nto a non-existent file.\n\nThe \"--\" passed explicitly to set was removed because rev-parse\noutputs the \"--\" argument that it is given.\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n Documentation/git-rev-parse.txt | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt\nindex b6c6326cd..7241e9689 100644\n--- a/Documentation/git-rev-parse.txt\n+++ b/Documentation/git-rev-parse.txt\n@@ -91,7 +91,8 @@ repository.  For example:\n ----\n prefix=$(git rev-parse --show-prefix)\n cd \"$(git rev-parse --show-toplevel)\"\n-eval \"set -- $(git rev-parse --sq --prefix \"$prefix\" \"$@\")\"\n+# rev-parse provides the -- needed for 'set'\n+eval \"set $(git rev-parse --sq --prefix \"$prefix\" -- \"$@\")\"\n ----\n \n --verify::\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"}]}