t7610: always work on a test-specific branch

Create and use a test-specific branch when the test might create a commit. This is not always necessary for correctness, but it improves debuggability by ensuring a commit created by test #N shows up on the testN branch, not the branch for test #N-1. Signed-off-by: Richard Hansen <hansenr@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Richard Hansen committed Jan 10, 2017 at 15:41 UTC 61b76d2de3e508e628cbb9a5718771309c2d4a81
1 file changed +8 -2
t/t7610-mergetool.sh
+8 -2
@@ -184,6 +184,7 @@ test_expect_success 'mergetool in subdir' '
184
185 test_expect_success 'mergetool on file in parent dir' '
186 test_when_finished "git reset --hard" &&
187 + git checkout -b test$test_count &&
188 git submodule update -N &&
189 (
190 cd subdir &&
@@ -217,6 +218,7 @@ test_expect_success 'mergetool skips autoresolved' '
218
219 test_expect_success 'mergetool merges all from subdir' '
220 test_when_finished "git reset --hard" &&
221 + git checkout -b test$test_count &&
222 test_config rerere.enabled false &&
223 (
224 cd subdir &&
@@ -288,7 +290,7 @@ test_expect_success 'mergetool takes partial path' '
290
291 test_expect_success 'mergetool delete/delete conflict' '
292 test_when_finished "git reset --hard HEAD" &&
291 - git checkout move-to-c &&
293 + git checkout -b test$test_count move-to-c &&
294 test_must_fail git merge move-to-b &&
295 echo d | git mergetool a/a/file.txt &&
296 ! test -f a/a/file.txt &&
@@ -304,6 +306,7 @@ test_expect_success 'mergetool delete/delete conflict' '
306
307 test_expect_success 'mergetool produces no errors when keepBackup is used' '
308 test_when_finished "git reset --hard HEAD" &&
309 + git checkout -b test$test_count &&
310 test_config mergetool.keepBackup true &&
311 test_must_fail git merge move-to-b &&
312 : >expect &&
@@ -314,6 +317,7 @@ test_expect_success 'mergetool produces no errors when keepBackup is used' '
317
318 test_expect_success 'mergetool honors tempfile config for deleted files' '
319 test_when_finished "git reset --hard HEAD" &&
320 + git checkout -b test$test_count &&
321 test_config mergetool.keepTemporaries false &&
322 test_must_fail git merge move-to-b &&
323 echo d | git mergetool a/a/file.txt &&
@@ -323,6 +327,7 @@ test_expect_success 'mergetool honors tempfile config for deleted files' '
327 test_expect_success 'mergetool keeps tempfiles when aborting delete/delete' '
328 test_when_finished "git reset --hard HEAD" &&
329 test_when_finished "git clean -fdx" &&
330 + git checkout -b test$test_count &&
331 test_config mergetool.keepTemporaries true &&
332 test_must_fail git merge move-to-b &&
333 ! (echo a; echo n) | git mergetool a/a/file.txt &&
@@ -641,7 +646,7 @@ test_expect_success MKTEMP 'temporary filenames are used with mergetool.writeToT
646
647 test_expect_success 'diff.orderFile configuration is honored' '
648 test_when_finished "git reset --hard >/dev/null" &&
644 - git checkout order-file-side2 &&
649 + git checkout -b test$test_count order-file-side2 &&
650 test_config diff.orderFile order-file &&
651 test_config mergetool.myecho.cmd "echo \"\$LOCAL\"" &&
652 test_config mergetool.myecho.trustExitCode true &&
@@ -659,6 +664,7 @@ test_expect_success 'diff.orderFile configuration is honored' '
664 '
665 test_expect_success 'mergetool -Oorder-file is honored' '
666 test_when_finished "git reset --hard >/dev/null 2>&1" &&
667 + git checkout -b test$test_count &&
668 test_config diff.orderFile order-file &&
669 test_config mergetool.myecho.cmd "echo \"\$LOCAL\"" &&
670 test_config mergetool.myecho.trustExitCode true &&