Thread (1 message) 1 message, 1 author, 2024-11-22

Re: [PATCH v14 02/10] t/t5505-remote: test failure of set-head

From: Junio C Hamano <hidden>
Date: 2024-11-22 04:54:22

Bence Ferdinandy [off-list ref] writes:
-			result |= error(_("Could not setup %s"), buf.buf);
+			result |= error(_("Could not set up %s"), buf.buf);
Good eyes.
quoted hunk
diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh
index 9b50276646..4e127bf5b8 100755
--- a/t/t5505-remote.sh
+++ b/t/t5505-remote.sh
@@ -432,6 +432,18 @@ test_expect_success 'set-head --auto' '
 	)
 '
 
+test_expect_success REFFILES 'set-head --auto failure' '
Writing

	test_when_finished "rm -f test/.git/refs/remotes/origin/HEAD.lock" &&

here allows us not to worry about commands in the sequence before
the "rm" below failing unexpectedly.
quoted hunk
+	(
+		cd test &&
+		touch .git/refs/remotes/origin/HEAD.lock &&
+		git remote set-head --auto origin 2>errormsg ||
+		tail -n1 errormsg >output &&
Are we saying that it is OK for set-head not to fail here?  If not,
then this should be

		test_must_fail git remote set-head ... 2>err &&
		tail -n 1 err >actual &&

instead.
quoted hunk
+		rm .git/refs/remotes/origin/HEAD.lock &&
+		echo "error: Could not set up refs/remotes/origin/HEAD" >expect &&
+		test_cmp expect output
+	)
+'
+
 test_expect_success 'set-head --auto has no problem w/multiple HEADs' '
 	(
 		cd test &&
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help