Subject: [PATCH v3 08/13] t7610: always work on a test-specific branch

From: Richard Hansen <[email-masked]>
Date: Mon, 9 Jan 2017 00:42:33 -0500

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 <[email-masked]>
---
 t/t7610-mergetool.sh | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh
index 7d5e1df88..efcf5c3f1 100755
--- a/t/t7610-mergetool.sh
+++ b/t/t7610-mergetool.sh
@@ -184,6 +184,7 @@ test_expect_success 'mergetool in subdir' '
 
 test_expect_success 'mergetool on file in parent dir' '
 	test_when_finished "git reset --hard" &&
+	git checkout -b test$test_count &&
 	git submodule update -N &&
 	(
 		cd subdir &&
@@ -217,6 +218,7 @@ test_expect_success 'mergetool skips autoresolved' '
 
 test_expect_success 'mergetool merges all from subdir' '
 	test_when_finished "git reset --hard" &&
+	git checkout -b test$test_count &&
 	test_config rerere.enabled false &&
 	(
 		cd subdir &&
@@ -288,7 +290,7 @@ test_expect_success 'mergetool takes partial path' '
 
 test_expect_success 'mergetool delete/delete conflict' '
 	test_when_finished "git reset --hard HEAD" &&
-	git checkout move-to-c &&
+	git checkout -b test$test_count move-to-c &&
 	test_must_fail git merge move-to-b &&
 	echo d | git mergetool a/a/file.txt &&
 	! test -f a/a/file.txt &&
@@ -304,6 +306,7 @@ test_expect_success 'mergetool delete/delete conflict' '
 
 test_expect_success 'mergetool produces no errors when keepBackup is used' '
 	test_when_finished "git reset --hard HEAD" &&
+	git checkout -b test$test_count &&
 	test_config mergetool.keepBackup true &&
 	test_must_fail git merge move-to-b &&
 	: >expect &&
@@ -314,6 +317,7 @@ test_expect_success 'mergetool produces no errors when keepBackup is used' '
 
 test_expect_success 'mergetool honors tempfile config for deleted files' '
 	test_when_finished "git reset --hard HEAD" &&
+	git checkout -b test$test_count &&
 	test_config mergetool.keepTemporaries false &&
 	test_must_fail git merge move-to-b &&
 	echo d | git mergetool a/a/file.txt &&
@@ -323,6 +327,7 @@ test_expect_success 'mergetool honors tempfile config for deleted files' '
 test_expect_success 'mergetool keeps tempfiles when aborting delete/delete' '
 	test_when_finished "git reset --hard HEAD" &&
 	test_when_finished "git clean -fdx" &&
+	git checkout -b test$test_count &&
 	test_config mergetool.keepTemporaries true &&
 	test_must_fail git merge move-to-b &&
 	! (echo a; echo n) | git mergetool a/a/file.txt &&
@@ -640,7 +645,7 @@ test_expect_success MKTEMP 'temporary filenames are used with mergetool.writeToT
 
 test_expect_success 'diff.orderFile configuration is honored' '
 	test_when_finished "git reset --hard >/dev/null" &&
-	git checkout order-file-side2 &&
+	git checkout -b test$test_count order-file-side2 &&
 	test_config diff.orderFile order-file &&
 	test_config mergetool.myecho.cmd "echo \"\$LOCAL\"" &&
 	test_config mergetool.myecho.trustExitCode true &&
@@ -658,6 +663,7 @@ test_expect_success 'diff.orderFile configuration is honored' '
 '
 test_expect_success 'mergetool -Oorder-file is honored' '
 	test_when_finished "git reset --hard >/dev/null 2>&1" &&
+	git checkout -b test$test_count &&
 	test_config diff.orderFile order-file &&
 	test_config mergetool.myecho.cmd "echo \"\$LOCAL\"" &&
 	test_config mergetool.myecho.trustExitCode true &&
-- 
2.11.0.390.gc69c2f50cf-goog