{"thread":{"id":"65245","subject":"[PATCH] remote: use plural-only message for diverged branch status","startedAt":"2026-03-14T09:12:09Z","lastAt":"2026-03-25T04:29:42Z","messageCount":9,"participants":["Harald Nordgren via GitGitGadget","Harald Nordgren","Junio C Hamano","Phillip Wood","Kaartic Sivaraam"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"538965","messageId":"pull.2239.git.git.1773479526823.gitgitgadget@gmail.com","threadId":"65245","inReplyTo":null,"subject":"[PATCH] remote: use plural-only message for diverged branch status","fromName":"Harald Nordgren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-03-14T09:12:06Z","receivedAt":"2026-03-14T09:12:09Z","isPatch":true,"body":"From: Harald Nordgren <haraldnordgren@gmail.com>\n\nDrop Q_() singular form and use _() with the plural string only.\n\nSigned-off-by: Harald Nordgren <haraldnordgren@gmail.com>\n---\n    format_branch_comparison: diverged message has only plural case\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2239%2FHaraldNordgren%2Fformat_branch_comparison__plural-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2239/HaraldNordgren/format_branch_comparison__plural-v1\nPull-Request: https://github.com/git/git/pull/2239\n\n remote.c | 9 ++-------\n 1 file changed, 2 insertions(+), 7 deletions(-)\n\ndiff --git a/remote.c b/remote.c\nindex 7ca2a6501b..12136dfa23 100644\n--- a/remote.c\n+++ b/remote.c\n@@ -2307,13 +2307,8 @@ static void format_branch_comparison(struct strbuf *sb,\n \t\t\t\t_(\"  (use \\\"git pull\\\" to update your local branch)\\n\"));\n \t} else {\n \t\tstrbuf_addf(sb,\n-\t\t\tQ_(\"Your branch and '%s' have diverged,\\n\"\n-\t\t\t       \"and have %d and %d different commit each, \"\n-\t\t\t       \"respectively.\\n\",\n-\t\t\t   \"Your branch and '%s' have diverged,\\n\"\n-\t\t\t       \"and have %d and %d different commits each, \"\n-\t\t\t       \"respectively.\\n\",\n-\t\t\t   ours + theirs),\n+\t\t\t_(\"Your branch and '%s' have diverged,\\n\"\n+\t\t\t       \"and have %d and %d different commits each, respectively.\\n\"),\n \t\t\tbranch_name, ours, theirs);\n \t\tif (use_divergence_advice && advice_enabled(ADVICE_STATUS_HINTS))\n \t\t\tstrbuf_addstr(sb,\n\nbase-commit: dc6ecd5354dca88d51b6d6562777fc8fc10d77e1\n-- \ngitgitgadget\n"},{"id":"538966","messageId":"20260314091618.88072-1-haraldnordgren@gmail.com","threadId":"65245","inReplyTo":"pull.2239.git.git.1773479526823.gitgitgadget@gmail.com","subject":"Re: [PATCH] checkout: add --autostash option for branch switching","fromName":"Harald Nordgren","fromEmail":"haraldnordgren@gmail.com","sentAt":"2026-03-14T09:16:18Z","receivedAt":"2026-03-14T09:16:21Z","isPatch":true,"body":">> Harald Nordgren (2):\n>>   refactor format_branch_comparison in preparation\n>>   status: show comparison with push remote tracking branch\n>>\n>>  remote.c                 | 183 ++++++++++++++++++++-------\n>>  t/t6040-tracking-info.sh | 262 +++++++++++++++++++++++++++++++++++++++\n>>  2 files changed, 403 insertions(+), 42 deletions(-)\n>>\n>>\n>> base-commit: d529f3a197364881746f558e5652f0236131eb86\n>> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2138%2FHaraldNordgren%2Fahead_of_main_status-v20\n>> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2138/HaraldNordgren/ahead_of_main_status-v20\n>> Pull-Request: https://github.com/git/git/pull/2138\n>>\n>> Range-diff vs v19:\n>>\n>>  1:  451d7a4986 ! 1:  bb3e00863b refactor format_branch_comparison in preparation\n>>      @@ remote.c: int format_tracking_info(struct branch *branch, struct strbuf *sb,\n>>        \t\tif (advice_enabled(ADVICE_STATUS_HINTS))\n>>        \t\t\tstrbuf_addstr(sb,\n>>        \t\t\t\t_(\"  (use \\\"git pull\\\" to update your local branch)\\n\"));\n>>      -@@ remote.c: int format_tracking_info(struct branch *branch, struct strbuf *sb,\n>>      - \t\t\t       \"and have %d and %d different commits each, \"\n>>      - \t\t\t       \"respectively.\\n\",\n>>      - \t\t\t   ours + theirs),\n>>      + \t} else {\n>>      + \t\tstrbuf_addf(sb,\n>>      +-\t\t\tQ_(\"Your branch and '%s' have diverged,\\n\"\n>>      +-\t\t\t       \"and have %d and %d different commit each, \"\n>>      +-\t\t\t       \"respectively.\\n\",\n>>      +-\t\t\t   \"Your branch and '%s' have diverged,\\n\"\n>>      +-\t\t\t       \"and have %d and %d different commits each, \"\n>>      +-\t\t\t       \"respectively.\\n\",\n>>      +-\t\t\t   ours + theirs),\n>>       -\t\t\tbase, ours, theirs);\n>>      ++\t\t\t\"Your branch and '%s' have diverged,\\n\"\n>>      ++\t\t\t       \"and have %d and %d different commits each, respectively.\\n\",\n>>       +\t\t\tbranch_name, ours, theirs);\n>>        \t\tif (show_divergence_advice &&\n>>        \t\t    advice_enabled(ADVICE_STATUS_HINTS))\n>\n> Could you not mix the ours+theirs thing into the same step?  Either\n> make it a standalone patch to clean up before or after your main 2\n> patches, or leave it totally outside the series and send it after\n> this series settles.\n\nMaking a change that was left out of https://lore.kernel.org/git/xmqqzf6lqs9w.fsf@gitster.g/\n\nHarald\n"},{"id":"538979","messageId":"xmqqqzpmwdyi.fsf@gitster.g","threadId":"65245","inReplyTo":"pull.2239.git.git.1773479526823.gitgitgadget@gmail.com","subject":"Re: [PATCH] remote: use plural-only message for diverged branch status","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-03-14T16:52:37Z","receivedAt":"2026-03-14T16:52:39Z","isPatch":true,"body":"\"Harald Nordgren via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> From: Harald Nordgren <haraldnordgren@gmail.com>\n>\n> Drop Q_() singular form and use _() with the plural string only.\n\nI know the commit title talks about plural-only, but please make\nsure that the body of the log message carries all the necessary\ninformation to justify the change standalone.  \"In the else clause,\nboth ours and theirs are positive integers so ours+theirs must be at\nleast 2, hence there is no need to prepare singular and plural\nvariants of the message\", or something to that effect, perhaps.\n\nThe patch text and the reasoning behind it does sound familiar and I\nvaguely recall discussing about it ;-)\n\nThanks.\n\n\n> Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>\n> ---\n>     format_branch_comparison: diverged message has only plural case\n>\n> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2239%2FHaraldNordgren%2Fformat_branch_comparison__plural-v1\n> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2239/HaraldNordgren/format_branch_comparison__plural-v1\n> Pull-Request: https://github.com/git/git/pull/2239\n>\n>  remote.c | 9 ++-------\n>  1 file changed, 2 insertions(+), 7 deletions(-)\n>\n> diff --git a/remote.c b/remote.c\n> index 7ca2a6501b..12136dfa23 100644\n> --- a/remote.c\n> +++ b/remote.c\n> @@ -2307,13 +2307,8 @@ static void format_branch_comparison(struct strbuf *sb,\n>  \t\t\t\t_(\"  (use \\\"git pull\\\" to update your local branch)\\n\"));\n>  \t} else {\n>  \t\tstrbuf_addf(sb,\n> -\t\t\tQ_(\"Your branch and '%s' have diverged,\\n\"\n> -\t\t\t       \"and have %d and %d different commit each, \"\n> -\t\t\t       \"respectively.\\n\",\n> -\t\t\t   \"Your branch and '%s' have diverged,\\n\"\n> -\t\t\t       \"and have %d and %d different commits each, \"\n> -\t\t\t       \"respectively.\\n\",\n> -\t\t\t   ours + theirs),\n> +\t\t\t_(\"Your branch and '%s' have diverged,\\n\"\n> +\t\t\t       \"and have %d and %d different commits each, respectively.\\n\"),\n>  \t\t\tbranch_name, ours, theirs);\n>  \t\tif (use_divergence_advice && advice_enabled(ADVICE_STATUS_HINTS))\n>  \t\t\tstrbuf_addstr(sb,\n>\n> base-commit: dc6ecd5354dca88d51b6d6562777fc8fc10d77e1\n"},{"id":"538987","messageId":"xmqqtsuiuugy.fsf@gitster.g","threadId":"65245","inReplyTo":"xmqqqzpmwdyi.fsf@gitster.g","subject":"Re: [PATCH] remote: use plural-only message for diverged branch status","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-03-14T18:38:53Z","receivedAt":"2026-03-14T18:38:55Z","isPatch":true,"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> \"Harald Nordgren via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n>\n>> From: Harald Nordgren <haraldnordgren@gmail.com>\n>>\n>> Drop Q_() singular form and use _() with the plural string only.\n>\n> I know the commit title talks about plural-only, but please make\n> sure that the body of the log message carries all the necessary\n> information to justify the change standalone.  \"In the else clause,\n> both ours and theirs are positive integers so ours+theirs must be at\n> least 2, hence there is no need to prepare singular and plural\n> variants of the message\", or something to that effect, perhaps.\n>\n> The patch text and the reasoning behind it does sound familiar and I\n> vaguely recall discussing about it ;-)\n>\n> Thanks.\n\nI queued the patch, tentatively with this rewritten message:\n\n    remote: don't use Q_() when it is not needed\n\n    In this code path, both ours and theirs are already known to be\n    positive integers, so ours + theirs will always be plural, never\n    using the first variant given to Q_().\n\n    Just use _() with the plural string only.\n\n    Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>\n    Signed-off-by: Junio C Hamano <gitster@pobox.com>\n\nThanks.\n"},{"id":"538990","messageId":"ca6e021e-0301-496d-8bd1-b646487ccbf6@gmail.com","threadId":"65245","inReplyTo":"xmqqtsuiuugy.fsf@gitster.g","subject":"Re: [PATCH] remote: use plural-only message for diverged branch status","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2026-03-14T20:08:15Z","receivedAt":"2026-03-14T20:08:19Z","isPatch":true,"body":"On 14/03/2026 18:38, Junio C Hamano wrote:\n> \n>      remote: don't use Q_() when it is not needed\n> \n>      In this code path, both ours and theirs are already known to be\n>      positive integers, so ours + theirs will always be plural, never\n>      using the first variant given to Q_().\n> \n>      Just use _() with the plural string only.\n\nThere can be more than one form of the plural string though. The gettext \nmanual has the following example of the Polish translation of \"file\" for \ndifferent numbers of files [1]\n\n\t1 plik\n\t2,3,4 pliki\n\t5-21 plików\n\t22-24 pliki\n\t25-31 plików\n\nngettext() handles that correctly, translating a single string without \nan associated count will not.\n\nThanks\n\nPhillip\n\n[1] \nhttps://www.gnu.org/software/gettext/manual/gettext.html#Additional-functions-for-plural-forms\n"},{"id":"539005","messageId":"xmqqjyvdvo7t.fsf@gitster.g","threadId":"65245","inReplyTo":"ca6e021e-0301-496d-8bd1-b646487ccbf6@gmail.com","subject":"Re: [PATCH] remote: use plural-only message for diverged branch status","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-03-15T02:08:38Z","receivedAt":"2026-03-15T02:08:41Z","isPatch":true,"body":"Phillip Wood <phillip.wood123@gmail.com> writes:\n\n> There can be more than one form of the plural string though. The gettext \n> manual has the following example of the Polish translation of \"file\" for \n> different numbers of files [1]\n>\n> \t1 plik\n> \t2,3,4 pliki\n> \t5-21 plików\n> \t22-24 pliki\n> \t25-31 plików\n>\n> ngettext() handles that correctly, translating a single string without \n> an associated count will not.\n\nThat is a very interesting example, and a valid reason to have me\nretract the #leftoverbits that led to the patch being discussed.\n\nBut wouldn't that lead to an awkward conclusion, i.e., hits from\n\"git grep '[^Q]_(\"[^\"]*%[id]' \\*.c\" are potential bugs that need to\nbe updated to use ngettext().\n\nOf course, we need to exclude messages like \"the error code %d was\nreturned\" and \"you have a bug on line %d\", but there seem to be real\nerrors in randomly selected hits from the \"git grep\" output, e.g.,\n\nadd-patch.c:\t\t\t\t\t\t _(\"Split into %d hunks.\"),\narchive-zip.c:\t\treturn error(_(\"path too long (%d chars, SHA1: %s): %s\"),\nbuiltin/checkout.c:\t    die(_(\"'%s' matched multiple (%d) remote tracking branches\"),\nbuiltin/credential-store.c:\t\tdie_errno(_(\"unable to get credential storage lock in %d ms\"), timeout_ms);\nbuiltin/describe.c:\t\t\t\t_(\"found %i tags; gave up search at %s\\n\"),\nbuiltin/fsck.c:\t\tfprintf_ln(stderr, _(\"Checking connectivity (%d objects)\"), max);\n\nYou can notice that I started from 'a' and stopped very early in 'b'\n;-).\n\nThanks.\n"},{"id":"539092","messageId":"75c85249-1cff-425a-8e77-98d55215c324@gmail.com","threadId":"65245","inReplyTo":"xmqqjyvdvo7t.fsf@gitster.g","subject":"Re: [PATCH] remote: use plural-only message for diverged branch status","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2026-03-16T10:49:26Z","receivedAt":"2026-03-16T10:49:31Z","isPatch":true,"body":"On 15/03/2026 02:08, Junio C Hamano wrote:\n> Phillip Wood <phillip.wood123@gmail.com> writes:\n> \n>> There can be more than one form of the plural string though. The gettext\n>> manual has the following example of the Polish translation of \"file\" for\n>> different numbers of files [1]\n>>\n>> \t1 plik\n>> \t2,3,4 pliki\n>> \t5-21 plików\n>> \t22-24 pliki\n>> \t25-31 plików\n>>\n>> ngettext() handles that correctly, translating a single string without\n>> an associated count will not.\n> \n> That is a very interesting example, and a valid reason to have me\n> retract the #leftoverbits that led to the patch being discussed.\n> \n> But wouldn't that lead to an awkward conclusion, i.e., hits from\n> \"git grep '[^Q]_(\"[^\"]*%[id]' \\*.c\" are potential bugs that need to\n> be updated to use ngettext().\n\nI think it does - maybe we should suggest fixing these as a miroproject \nfor GSoC and Outreachy? It certainly looks like there are plenty of them.\n\nThanks\n\nPhillip\n\n> Of course, we need to exclude messages like \"the error code %d was\n> returned\" and \"you have a bug on line %d\", but there seem to be real\n> errors in randomly selected hits from the \"git grep\" output, e.g.,\n> \n> add-patch.c:\t\t\t\t\t\t _(\"Split into %d hunks.\"),\n> archive-zip.c:\t\treturn error(_(\"path too long (%d chars, SHA1: %s): %s\"),\n> builtin/checkout.c:\t    die(_(\"'%s' matched multiple (%d) remote tracking branches\"),\n> builtin/credential-store.c:\t\tdie_errno(_(\"unable to get credential storage lock in %d ms\"), timeout_ms);\n> builtin/describe.c:\t\t\t\t_(\"found %i tags; gave up search at %s\\n\"),\n> builtin/fsck.c:\t\tfprintf_ln(stderr, _(\"Checking connectivity (%d objects)\"), max);\n> \n> You can notice that I started from 'a' and stopped very early in 'b'\n> ;-).\n> \n> Thanks.\n\n"},{"id":"539136","messageId":"xmqqms07putp.fsf@gitster.g","threadId":"65245","inReplyTo":"75c85249-1cff-425a-8e77-98d55215c324@gmail.com","subject":"Re: [PATCH] remote: use plural-only message for diverged branch status","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-03-16T17:06:58Z","receivedAt":"2026-03-16T17:07:01Z","isPatch":true,"body":"Phillip Wood <phillip.wood123@gmail.com> writes:\n\n> On 15/03/2026 02:08, Junio C Hamano wrote:\n>> Phillip Wood <phillip.wood123@gmail.com> writes:\n>> \n>>> There can be more than one form of the plural string though. The gettext\n>>> manual has the following example of the Polish translation of \"file\" for\n>>> different numbers of files [1]\n>>>\n>>> \t1 plik\n>>> \t2,3,4 pliki\n>>> \t5-21 plików\n>>> \t22-24 pliki\n>>> \t25-31 plików\n>>>\n>>> ngettext() handles that correctly, translating a single string without\n>>> an associated count will not.\n>> \n>> That is a very interesting example, and a valid reason to have me\n>> retract the #leftoverbits that led to the patch being discussed.\n>> \n>> But wouldn't that lead to an awkward conclusion, i.e., hits from\n>> \"git grep '[^Q]_(\"[^\"]*%[id]' \\*.c\" are potential bugs that need to\n>> be updated to use ngettext().\n>\n> I think it does - maybe we should suggest fixing these as a miroproject \n> for GSoC and Outreachy? It certainly looks like there are plenty of them.\n\nThat would be great.  It needs a bit of thinking, the required\nchange for each of them is quite small, and there are tons of them.\nAn ideal candidate for a microproject.\n\nAdding it to the list of microproject ideas is a good #leftoverbits\nas well.\n\n>\n> Thanks\n>\n> Phillip\n>\n>> Of course, we need to exclude messages like \"the error code %d was\n>> returned\" and \"you have a bug on line %d\", but there seem to be real\n>> errors in randomly selected hits from the \"git grep\" output, e.g.,\n>> \n>> add-patch.c:\t\t\t\t\t\t _(\"Split into %d hunks.\"),\n>> archive-zip.c:\t\treturn error(_(\"path too long (%d chars, SHA1: %s): %s\"),\n>> builtin/checkout.c:\t    die(_(\"'%s' matched multiple (%d) remote tracking branches\"),\n>> builtin/credential-store.c:\t\tdie_errno(_(\"unable to get credential storage lock in %d ms\"), timeout_ms);\n>> builtin/describe.c:\t\t\t\t_(\"found %i tags; gave up search at %s\\n\"),\n>> builtin/fsck.c:\t\tfprintf_ln(stderr, _(\"Checking connectivity (%d objects)\"), max);\n>> \n>> You can notice that I started from 'a' and stopped very early in 'b'\n>> ;-).\n>> \n>> Thanks.\n"},{"id":"539892","messageId":"CA+ARAtovu6FrCEfYRd0mRz_KChkXPr6s=Er0-uCcFqfYLVU+=A@mail.gmail.com","threadId":"65245","inReplyTo":"xmqqms07putp.fsf@gitster.g","subject":"Re: [PATCH] remote: use plural-only message for diverged branch status","fromName":"Kaartic Sivaraam","fromEmail":"kaartic.sivaraam@gmail.com","sentAt":"2026-03-25T04:29:21Z","receivedAt":"2026-03-25T04:29:42Z","isPatch":true,"body":"On Mon, Mar 16, 2026 at 10:37 PM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Phillip Wood <phillip.wood123@gmail.com> writes:\n>\n> >> But wouldn't that lead to an awkward conclusion, i.e., hits from\n> >> \"git grep '[^Q]_(\"[^\"]*%[id]' \\*.c\" are potential bugs that need to\n> >> be updated to use ngettext().\n> >\n> > I think it does - maybe we should suggest fixing these as a miroproject\n> > for GSoC and Outreachy? It certainly looks like there are plenty of them.\n>\n> That would be great.  It needs a bit of thinking, the required\n> change for each of them is quite small, and there are tons of them.\n> An ideal candidate for a microproject.\n>\n> Adding it to the list of microproject ideas is a good #leftoverbits\n> as well.\n>\n\nThis has been added to the microprojects list now. Do check and\nlet us know in case it needs any tweaks.\n\n  https://git.github.io/SoC-2026-Microprojects#fix-improper-pluralization-to-use-ngettext\n\nThanks.\n\n--\nSivaraam\n"}]}