t7610: don't assume the checked-out commit

Always check out the required commit at the beginning of the test so that a failure in a previous test does not cause the test to work off of the wrong commit. This is a step toward making the tests more independent so that if one test fails it doesn't cause subsequent tests to fail. Signed-off-by: Richard Hansen <hansenr@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Richard Hansen committed Jan 10, 2017 at 15:41 UTC fef6c06d6401458f47b5beb9822c75c74a2eb07f
1 file changed +6 -6
t/t7610-mergetool.sh
+6 -6
@@ -184,7 +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 &&
187 + git checkout -b test$test_count branch1 &&
188 git submodule update -N &&
189 (
190 cd subdir &&
@@ -218,7 +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 &&
221 + git checkout -b test$test_count branch1 &&
222 test_config rerere.enabled false &&
223 (
224 cd subdir &&
@@ -306,7 +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 &&
309 + git checkout -b test$test_count move-to-c &&
310 test_config mergetool.keepBackup true &&
311 test_must_fail git merge move-to-b &&
312 : >expect &&
@@ -317,7 +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 &&
320 + git checkout -b test$test_count move-to-c &&
321 test_config mergetool.keepTemporaries false &&
322 test_must_fail git merge move-to-b &&
323 echo d | git mergetool a/a/file.txt &&
@@ -327,7 +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 &&
330 + git checkout -b test$test_count move-to-c &&
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 &&
@@ -664,7 +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 &&
667 + git checkout -b test$test_count order-file-side2 &&
668 test_config diff.orderFile order-file &&
669 test_config mergetool.myecho.cmd "echo \"\$LOCAL\"" &&
670 test_config mergetool.myecho.trustExitCode true &&