{"thread":{"id":"66652","subject":"[GSoC PATCH v2] object-name: use Q_() for the reflog entry count","startedAt":"2026-10-24T15:29:31Z","lastAt":"2026-10-25T04:26:01Z","messageCount":2,"participants":["Aniket Gupta","Junio C Hamano"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"556168","messageId":"20261024152931.440-1-aniketgupta3001@gmail.com","threadId":"66652","inReplyTo":null,"subject":"[GSoC PATCH v2] object-name: use Q_() for the reflog entry count","fromName":"Aniket Gupta","fromEmail":"aniketgupta3001@gmail.com","sentAt":"2026-10-24T15:29:31Z","receivedAt":"2026-10-24T15:29:31Z","isPatch":true,"sender":{"key":"aniketgupta3001@gmail.com","avatar":null},"body":"When reflog is asked for an entry that it doesnt have, for eg with\n\"HEAD@{5}\" get_oid_basic() reports how many entries the log has. The\nmessage is not marked for plural forms and a log with one entry says\nthat \"only has 1 entries\"\n\nUse Q_() so that the singular is used for one entry so that\ntranslations for languages with other plural forms also can have the\nright form for each count.\n\nSigned-off-by: Aniket Gupta <aniketgupta3001@gmail.com>\n---\nChanges since v1: t1506 was also looking for \"entries\" and thus\nfailed with a one-entry reflog. Now it matches \"entr\" just like Junio\nsuggested\n\nv1: https://lore.kernel.org/git/20261023133118.456-1-aniketgupta3001@gmail.com/\n\n object-name.c                  |  4 +++-\n t/t1400-update-ref.sh          | 14 ++++++++++++++\n t/t1506-rev-parse-diagnosis.sh |  4 ++--\n 3 files changed, 19 insertions(+), 3 deletions(-)\n\ndiff --git a/object-name.c b/object-name.c\nindex 654668576..eeaac2ddc 100644\n--- a/object-name.c\n+++ b/object-name.c\n@@ -810,7 +810,9 @@ static int get_oid_basic(struct repository *r, const char *str, int len,\n \t\t\t\tif (flags & GET_OID_QUIETLY) {\n \t\t\t\t\texit(128);\n \t\t\t\t}\n-\t\t\t\tdie(_(\"log for '%.*s' only has %d entries\"),\n+\t\t\t\tdie(Q_(\"log for '%.*s' only has %d entry\",\n+\t\t\t\t       \"log for '%.*s' only has %d entries\",\n+\t\t\t\t       co_cnt),\n \t\t\t\t    len, str, co_cnt);\n \t\t\t}\n \t\t\tif (flags & GET_OID_GENTLY) {\ndiff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh\nindex 1a164c96f..1d1b46379 100755\n--- a/t/t1400-update-ref.sh\n+++ b/t/t1400-update-ref.sh\n@@ -458,6 +458,20 @@ test_expect_success 'query reflog with gap' '\n \ttest_grep -F \"warning: log for ref $m has gap after $gd\" stderr\n '\n \n+test_expect_success 'reflog entry out of range reports how many there are' '\n+\ttest_when_finished \"git update-ref -d $m\" &&\n+\n+\tGIT_COMMITTER_DATE=\"1117150320 -0500\" git update-ref $m $A &&\n+\ttest_must_fail git rev-parse --verify \"main@{5}\" 2>actual &&\n+\techo \"fatal: log for ${SQ}main${SQ} only has 1 entry\" >expect &&\n+\ttest_cmp expect actual &&\n+\n+\tGIT_COMMITTER_DATE=\"1117150380 -0500\" git update-ref $m $B &&\n+\ttest_must_fail git rev-parse --verify \"main@{5}\" 2>actual &&\n+\techo \"fatal: log for ${SQ}main${SQ} only has 2 entries\" >expect &&\n+\ttest_cmp expect actual\n+'\n+\n test_expect_success 'creating initial files' '\n \ttest_when_finished rm -f M &&\n \techo TEST >F &&\ndiff --git a/t/t1506-rev-parse-diagnosis.sh b/t/t1506-rev-parse-diagnosis.sh\nindex 722884e65..9a4b93b79 100755\n--- a/t/t1506-rev-parse-diagnosis.sh\n+++ b/t/t1506-rev-parse-diagnosis.sh\n@@ -142,10 +142,10 @@ test_expect_success 'incorrect file in :path and :N:path' '\n test_expect_success 'invalid @{n} reference' '\n \ttest_must_fail git rev-parse main@{99999} >output 2>error &&\n \ttest_must_be_empty output &&\n-\ttest_grep \"log for [^ ]* only has [0-9][0-9]* entries\" error  &&\n+\ttest_grep \"log for [^ ]* only has [0-9][0-9]* entr\" error &&\n \ttest_must_fail git rev-parse --verify main@{99999} >output 2>error &&\n \ttest_must_be_empty output &&\n-\ttest_grep \"log for [^ ]* only has [0-9][0-9]* entries\" error\n+\ttest_grep \"log for [^ ]* only has [0-9][0-9]* entr\" error\n '\n \n test_expect_success 'relative path not found' '\n-- \n2.43.0\n\n\n"},{"id":"556197","messageId":"xmqqa4o2z9ra.fsf@gitster.g","threadId":"66652","inReplyTo":"20261024152931.440-1-aniketgupta3001@gmail.com","subject":"Re: [GSoC PATCH v2] object-name: use Q_() for the reflog entry count","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-10-25T04:26:01Z","receivedAt":"2026-10-25T04:26:01Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Aniket Gupta <aniketgupta3001@gmail.com> writes:\n\n> When reflog is asked for an entry that it doesnt have, for eg with\n> \"HEAD@{5}\" get_oid_basic() reports how many entries the log has. The\n> message is not marked for plural forms and a log with one entry says\n> that \"only has 1 entries\"\n>\n> Use Q_() so that the singular is used for one entry so that\n> translations for languages with other plural forms also can have the\n> right form for each count.\n>\n> Signed-off-by: Aniket Gupta <aniketgupta3001@gmail.com>\n> ---\n> Changes since v1: t1506 was also looking for \"entries\" and thus\n> failed with a one-entry reflog. Now it matches \"entr\" just like Junio\n> suggested\n>\n> v1: https://lore.kernel.org/git/20261023133118.456-1-aniketgupta3001@gmail.com/\n\nYour v2 must be a reply to your v1 message.\n\n"}]}