diff mbox series

[v2] t3200: clean side effect of git checkout --orphan

Message ID 20200830224200.21103-1-alipman88@gmail.com (mailing list archive)
State Accepted
Commit e6d5a11fed0bd6871a16e9004d960f1447529e67
Headers show
Series [v2] t3200: clean side effect of git checkout --orphan | expand

Commit Message

Aaron Lipman Aug. 30, 2020, 10:42 p.m. UTC
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>
---
Whoops, fixed the effected/affected error.
Thanks for catching that, Eric!

 t/t3200-branch.sh | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index 4c0734157b..028c88d1b2 100755
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
@@ -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