]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t3200: clean side effect of git checkout --orphan
authorAaron Lipman <alipman88@gmail.com>
Sun, 30 Aug 2020 22:42:00 +0000 (18:42 -0400)
committerJunio C Hamano <gitster@pobox.com>
Tue, 8 Sep 2020 22:44:25 +0000 (15:44 -0700)
The "refuse --edit-description on unborn branch for now" test in t3200
switches to an orphan branch, causing subsequent git commands
referencing HEAD to fail. Avoid this side-effect by switching back to
master after the test finishes.

This has gone undetected, as the next affected test expects failure -
but it currently fails for the wrong reason.

Verbose output of the next test referencing HEAD,
"--merged is incompatible with --no-merged":

  fatal: malformed object name HEAD

Which this commit corrects to:

  error: option `no-merged' is incompatible with --merged

Signed-off-by: Aaron Lipman <alipman88@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t3200-branch.sh

index 4c0734157ba0b88432ec583321bdb2143f0c4461..028c88d1b24efc945fb605360eda51a86f60bd36 100755 (executable)
@@ -1287,6 +1287,7 @@ test_expect_success 'detect typo in branch name when using --edit-description' '
 '
 
 test_expect_success 'refuse --edit-description on unborn branch for now' '
+       test_when_finished "git checkout master" &&
        write_script editor <<-\EOF &&
                echo "New contents" >"$1"
        EOF