git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [GSoC PATCH] object-name: use Q_() for the reflog entry count

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 24, 2026, 02:02 UTC
Message-ID
<xmqqv76r26vz.fsf@gitster.g>
In-Reply-To
<xmqq4ieb3mnu.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
Show 17 quoted lines
> not ok 13 - invalid @{n} reference
> #	
> #		test_must_fail git rev-parse main@{99999} >output 2>error &&
> #		test_must_be_empty output &&
> #		test_grep "log for [^ ]* only has [0-9][0-9]* entries" error  &&
> #		test_must_fail git rev-parse --verify main@{99999} >output 2>error &&
> #		test_must_be_empty output &&
> #		test_grep "log for [^ ]* only has [0-9][0-9]* entries" error
> #	
> 1..13
>
> It could be that t1506 is the only one that needs adjusting.
>
> $ git grep -n -e 'only has.*entries' -- :/t
> t/t1400-update-ref.sh:471:	echo "fatal: log for ${SQ}main${SQ} only has 2 entries" >expect &&
> t/t1506-rev-parse-diagnosis.sh:145:	test_grep "log for [^ ]* only has [0-9][0-9]* entries" error  &&
> t/t1506-rev-parse-diagnosis.sh:148:	test_grep "log for [^ ]* only has [0-9][0-9]* entries" error

The fix may look like this. With the extra commit disabled, the reflog has only 1 entry and "entries" no longer match (hence the pattern truncated to "entr"), and if you remove the leading ':' colon, the extra commit will grow the reflog by one entry, so the message will use the "entries" form. As you have added a new test to cover both singular and plural elsewhere, we may not have to make this test so thorough, so if you are going to take it, I'd recommend removing the extra commit.

 t/t1506-rev-parse-diagnosis.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git c/t/t1506-rev-parse-diagnosis.sh w/t/t1506-rev-parse-diagnosis.sh
index 722884e65f..e4dade392e 100755
--- c/t/t1506-rev-parse-diagnosis.sh
+++ w/t/t1506-rev-parse-diagnosis.sh
@@ -140,12 +140,13 @@ test_expect_success 'incorrect file in :path and :N:path' '
 '
 
 test_expect_success 'invalid @{n} reference' '
+	: git commit --allow-empty -m 'void' &&
 	test_must_fail git rev-parse main@{99999} >output 2>error &&
 	test_must_be_empty output &&
-	test_grep "log for [^ ]* only has [0-9][0-9]* entries" error  &&
+	test_grep "log for [^ ]* only has [1-9][0-9]* entr" error &&
 	test_must_fail git rev-parse --verify main@{99999} >output 2>error &&
 	test_must_be_empty output &&
-	test_grep "log for [^ ]* only has [0-9][0-9]* entries" error
+	test_grep "log for [^ ]* only has [1-9][0-9]* entr" error
 '
 
 test_expect_success 'relative path not found' '
Previous: Junio C HamanoNext: Aniket Gupta
Message 3 of 4 in “object-name: use Q_() for the reflog entry count”
  1. object-name: use Q_() for the reflog entry countAniket Gupta, Oct 23, 2026
  2. Junio C HamanoOct 24, 2026
  3. Junio C HamanoOct 24, 2026
  4. object-name: use Q_() for the reflog entry countAniket Gupta, Oct 25, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.