# [PATCH] remote: use plural-only message for diverged branch status

9 messages from 2026-03-14 to 2026-03-25. Participants: Harald Nordgren via GitGitGadget, Harald Nordgren, Junio C Hamano, Phillip Wood, Kaartic Sivaraam.
Thread: https://gitlist.dev/t/65245

## Harald Nordgren via GitGitGadget, 2026-03-14 09:12

Subject: [PATCH] remote: use plural-only message for diverged branch status
Message-ID: <pull.2239.git.git.1773479526823.gitgitgadget@gmail.com>
URL: https://gitlist.dev/e/pull.2239.git.git.1773479526823.gitgitgadget%40gmail.com

```
From: Harald Nordgren <haraldnordgren@gmail.com>

Drop Q_() singular form and use _() with the plural string only.

Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
---
    format_branch_comparison: diverged message has only plural case

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2239%2FHaraldNordgren%2Fformat_branch_comparison__plural-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2239/HaraldNordgren/format_branch_comparison__plural-v1
Pull-Request: https://github.com/git/git/pull/2239

 remote.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/remote.c b/remote.c
index 7ca2a6501b..12136dfa23 100644
--- a/remote.c
+++ b/remote.c
@@ -2307,13 +2307,8 @@ static void format_branch_comparison(struct strbuf *sb,
 				_("  (use \"git pull\" to update your local branch)\n"));
 	} else {
 		strbuf_addf(sb,
-			Q_("Your branch and '%s' have diverged,\n"
-			       "and have %d and %d different commit each, "
-			       "respectively.\n",
-			   "Your branch and '%s' have diverged,\n"
-			       "and have %d and %d different commits each, "
-			       "respectively.\n",
-			   ours + theirs),
+			_("Your branch and '%s' have diverged,\n"
+			       "and have %d and %d different commits each, respectively.\n"),
 			branch_name, ours, theirs);
 		if (use_divergence_advice && advice_enabled(ADVICE_STATUS_HINTS))
 			strbuf_addstr(sb,

base-commit: dc6ecd5354dca88d51b6d6562777fc8fc10d77e1
-- 
gitgitgadget

```

## Harald Nordgren, 2026-03-14 09:16

Subject: Re: [PATCH] checkout: add --autostash option for branch switching
Message-ID: <20260314091618.88072-1-haraldnordgren@gmail.com>
URL: https://gitlist.dev/e/20260314091618.88072-1-haraldnordgren%40gmail.com
In-Reply-To: <pull.2239.git.git.1773479526823.gitgitgadget@gmail.com>

```
>> Harald Nordgren (2):
>>   refactor format_branch_comparison in preparation
>>   status: show comparison with push remote tracking branch
>>
>>  remote.c                 | 183 ++++++++++++++++++++-------
>>  t/t6040-tracking-info.sh | 262 +++++++++++++++++++++++++++++++++++++++
>>  2 files changed, 403 insertions(+), 42 deletions(-)
>>
>>
>> base-commit: d529f3a197364881746f558e5652f0236131eb86
>> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2138%2FHaraldNordgren%2Fahead_of_main_status-v20
>> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2138/HaraldNordgren/ahead_of_main_status-v20
>> Pull-Request: https://github.com/git/git/pull/2138
>>
>> Range-diff vs v19:
>>
>>  1:  451d7a4986 ! 1:  bb3e00863b refactor format_branch_comparison in preparation
>>      @@ remote.c: int format_tracking_info(struct branch *branch, struct strbuf *sb,
>>        		if (advice_enabled(ADVICE_STATUS_HINTS))
>>        			strbuf_addstr(sb,
>>        				_("  (use \"git pull\" to update your local branch)\n"));
>>      -@@ remote.c: int format_tracking_info(struct branch *branch, struct strbuf *sb,
>>      - 			       "and have %d and %d different commits each, "
>>      - 			       "respectively.\n",
>>      - 			   ours + theirs),
>>      + 	} else {
>>      + 		strbuf_addf(sb,
>>      +-			Q_("Your branch and '%s' have diverged,\n"
>>      +-			       "and have %d and %d different commit each, "
>>      +-			       "respectively.\n",
>>      +-			   "Your branch and '%s' have diverged,\n"
>>      +-			       "and have %d and %d different commits each, "
>>      +-			       "respectively.\n",
>>      +-			   ours + theirs),
>>       -			base, ours, theirs);
>>      ++			"Your branch and '%s' have diverged,\n"
>>      ++			       "and have %d and %d different commits each, respectively.\n",
>>       +			branch_name, ours, theirs);
>>        		if (show_divergence_advice &&
>>        		    advice_enabled(ADVICE_STATUS_HINTS))
>
> Could you not mix the ours+theirs thing into the same step?  Either
> make it a standalone patch to clean up before or after your main 2
> patches, or leave it totally outside the series and send it after
> this series settles.

Making a change that was left out of https://lore.kernel.org/git/xmqqzf6lqs9w.fsf@gitster.g/

Harald

```

## Junio C Hamano, 2026-03-14 16:52

Subject: Re: [PATCH] remote: use plural-only message for diverged branch status
Message-ID: <xmqqqzpmwdyi.fsf@gitster.g>
URL: https://gitlist.dev/e/xmqqqzpmwdyi.fsf%40gitster.g
In-Reply-To: <pull.2239.git.git.1773479526823.gitgitgadget@gmail.com>

```
"Harald Nordgren via GitGitGadget" <gitgitgadget@gmail.com> writes:

> From: Harald Nordgren <haraldnordgren@gmail.com>
>
> Drop Q_() singular form and use _() with the plural string only.

I know the commit title talks about plural-only, but please make
sure that the body of the log message carries all the necessary
information to justify the change standalone.  "In the else clause,
both ours and theirs are positive integers so ours+theirs must be at
least 2, hence there is no need to prepare singular and plural
variants of the message", or something to that effect, perhaps.

The patch text and the reasoning behind it does sound familiar and I
vaguely recall discussing about it ;-)

Thanks.


> Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
> ---
>     format_branch_comparison: diverged message has only plural case
>
> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2239%2FHaraldNordgren%2Fformat_branch_comparison__plural-v1
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2239/HaraldNordgren/format_branch_comparison__plural-v1
> Pull-Request: https://github.com/git/git/pull/2239
>
>  remote.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/remote.c b/remote.c
> index 7ca2a6501b..12136dfa23 100644
> --- a/remote.c
> +++ b/remote.c
> @@ -2307,13 +2307,8 @@ static void format_branch_comparison(struct strbuf *sb,
>  				_("  (use \"git pull\" to update your local branch)\n"));
>  	} else {
>  		strbuf_addf(sb,
> -			Q_("Your branch and '%s' have diverged,\n"
> -			       "and have %d and %d different commit each, "
> -			       "respectively.\n",
> -			   "Your branch and '%s' have diverged,\n"
> -			       "and have %d and %d different commits each, "
> -			       "respectively.\n",
> -			   ours + theirs),
> +			_("Your branch and '%s' have diverged,\n"
> +			       "and have %d and %d different commits each, respectively.\n"),
>  			branch_name, ours, theirs);
>  		if (use_divergence_advice && advice_enabled(ADVICE_STATUS_HINTS))
>  			strbuf_addstr(sb,
>
> base-commit: dc6ecd5354dca88d51b6d6562777fc8fc10d77e1

```

## Junio C Hamano, 2026-03-14 18:38

Subject: Re: [PATCH] remote: use plural-only message for diverged branch status
Message-ID: <xmqqtsuiuugy.fsf@gitster.g>
URL: https://gitlist.dev/e/xmqqtsuiuugy.fsf%40gitster.g
In-Reply-To: <xmqqqzpmwdyi.fsf@gitster.g>

```
Junio C Hamano <gitster@pobox.com> writes:

> "Harald Nordgren via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
>> From: Harald Nordgren <haraldnordgren@gmail.com>
>>
>> Drop Q_() singular form and use _() with the plural string only.
>
> I know the commit title talks about plural-only, but please make
> sure that the body of the log message carries all the necessary
> information to justify the change standalone.  "In the else clause,
> both ours and theirs are positive integers so ours+theirs must be at
> least 2, hence there is no need to prepare singular and plural
> variants of the message", or something to that effect, perhaps.
>
> The patch text and the reasoning behind it does sound familiar and I
> vaguely recall discussing about it ;-)
>
> Thanks.

I queued the patch, tentatively with this rewritten message:

    remote: don't use Q_() when it is not needed

    In this code path, both ours and theirs are already known to be
    positive integers, so ours + theirs will always be plural, never
    using the first variant given to Q_().

    Just use _() with the plural string only.

    Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>

Thanks.

```

## Phillip Wood, 2026-03-14 20:08

Subject: Re: [PATCH] remote: use plural-only message for diverged branch status
Message-ID: <ca6e021e-0301-496d-8bd1-b646487ccbf6@gmail.com>
URL: https://gitlist.dev/e/ca6e021e-0301-496d-8bd1-b646487ccbf6%40gmail.com
In-Reply-To: <xmqqtsuiuugy.fsf@gitster.g>

```
On 14/03/2026 18:38, Junio C Hamano wrote:
> 
>      remote: don't use Q_() when it is not needed
> 
>      In this code path, both ours and theirs are already known to be
>      positive integers, so ours + theirs will always be plural, never
>      using the first variant given to Q_().
> 
>      Just use _() with the plural string only.

There can be more than one form of the plural string though. The gettext 
manual has the following example of the Polish translation of "file" for 
different numbers of files [1]

	1 plik
	2,3,4 pliki
	5-21 plików
	22-24 pliki
	25-31 plików

ngettext() handles that correctly, translating a single string without 
an associated count will not.

Thanks

Phillip

[1] 
https://www.gnu.org/software/gettext/manual/gettext.html#Additional-functions-for-plural-forms

```

## Junio C Hamano, 2026-03-15 02:08

Subject: Re: [PATCH] remote: use plural-only message for diverged branch status
Message-ID: <xmqqjyvdvo7t.fsf@gitster.g>
URL: https://gitlist.dev/e/xmqqjyvdvo7t.fsf%40gitster.g
In-Reply-To: <ca6e021e-0301-496d-8bd1-b646487ccbf6@gmail.com>

```
Phillip Wood <phillip.wood123@gmail.com> writes:

> There can be more than one form of the plural string though. The gettext 
> manual has the following example of the Polish translation of "file" for 
> different numbers of files [1]
>
> 	1 plik
> 	2,3,4 pliki
> 	5-21 plików
> 	22-24 pliki
> 	25-31 plików
>
> ngettext() handles that correctly, translating a single string without 
> an associated count will not.

That is a very interesting example, and a valid reason to have me
retract the #leftoverbits that led to the patch being discussed.

But wouldn't that lead to an awkward conclusion, i.e., hits from
"git grep '[^Q]_("[^"]*%[id]' \*.c" are potential bugs that need to
be updated to use ngettext().

Of course, we need to exclude messages like "the error code %d was
returned" and "you have a bug on line %d", but there seem to be real
errors in randomly selected hits from the "git grep" output, e.g.,

add-patch.c:						 _("Split into %d hunks."),
archive-zip.c:		return error(_("path too long (%d chars, SHA1: %s): %s"),
builtin/checkout.c:	    die(_("'%s' matched multiple (%d) remote tracking branches"),
builtin/credential-store.c:		die_errno(_("unable to get credential storage lock in %d ms"), timeout_ms);
builtin/describe.c:				_("found %i tags; gave up search at %s\n"),
builtin/fsck.c:		fprintf_ln(stderr, _("Checking connectivity (%d objects)"), max);

You can notice that I started from 'a' and stopped very early in 'b'
;-).

Thanks.

```

## Phillip Wood, 2026-03-16 10:49

Subject: Re: [PATCH] remote: use plural-only message for diverged branch status
Message-ID: <75c85249-1cff-425a-8e77-98d55215c324@gmail.com>
URL: https://gitlist.dev/e/75c85249-1cff-425a-8e77-98d55215c324%40gmail.com
In-Reply-To: <xmqqjyvdvo7t.fsf@gitster.g>

```
On 15/03/2026 02:08, Junio C Hamano wrote:
> Phillip Wood <phillip.wood123@gmail.com> writes:
> 
>> There can be more than one form of the plural string though. The gettext
>> manual has the following example of the Polish translation of "file" for
>> different numbers of files [1]
>>
>> 	1 plik
>> 	2,3,4 pliki
>> 	5-21 plików
>> 	22-24 pliki
>> 	25-31 plików
>>
>> ngettext() handles that correctly, translating a single string without
>> an associated count will not.
> 
> That is a very interesting example, and a valid reason to have me
> retract the #leftoverbits that led to the patch being discussed.
> 
> But wouldn't that lead to an awkward conclusion, i.e., hits from
> "git grep '[^Q]_("[^"]*%[id]' \*.c" are potential bugs that need to
> be updated to use ngettext().

I think it does - maybe we should suggest fixing these as a miroproject 
for GSoC and Outreachy? It certainly looks like there are plenty of them.

Thanks

Phillip

> Of course, we need to exclude messages like "the error code %d was
> returned" and "you have a bug on line %d", but there seem to be real
> errors in randomly selected hits from the "git grep" output, e.g.,
> 
> add-patch.c:						 _("Split into %d hunks."),
> archive-zip.c:		return error(_("path too long (%d chars, SHA1: %s): %s"),
> builtin/checkout.c:	    die(_("'%s' matched multiple (%d) remote tracking branches"),
> builtin/credential-store.c:		die_errno(_("unable to get credential storage lock in %d ms"), timeout_ms);
> builtin/describe.c:				_("found %i tags; gave up search at %s\n"),
> builtin/fsck.c:		fprintf_ln(stderr, _("Checking connectivity (%d objects)"), max);
> 
> You can notice that I started from 'a' and stopped very early in 'b'
> ;-).
> 
> Thanks.


```

## Junio C Hamano, 2026-03-16 17:06

Subject: Re: [PATCH] remote: use plural-only message for diverged branch status
Message-ID: <xmqqms07putp.fsf@gitster.g>
URL: https://gitlist.dev/e/xmqqms07putp.fsf%40gitster.g
In-Reply-To: <75c85249-1cff-425a-8e77-98d55215c324@gmail.com>

```
Phillip Wood <phillip.wood123@gmail.com> writes:

> On 15/03/2026 02:08, Junio C Hamano wrote:
>> Phillip Wood <phillip.wood123@gmail.com> writes:
>> 
>>> There can be more than one form of the plural string though. The gettext
>>> manual has the following example of the Polish translation of "file" for
>>> different numbers of files [1]
>>>
>>> 	1 plik
>>> 	2,3,4 pliki
>>> 	5-21 plików
>>> 	22-24 pliki
>>> 	25-31 plików
>>>
>>> ngettext() handles that correctly, translating a single string without
>>> an associated count will not.
>> 
>> That is a very interesting example, and a valid reason to have me
>> retract the #leftoverbits that led to the patch being discussed.
>> 
>> But wouldn't that lead to an awkward conclusion, i.e., hits from
>> "git grep '[^Q]_("[^"]*%[id]' \*.c" are potential bugs that need to
>> be updated to use ngettext().
>
> I think it does - maybe we should suggest fixing these as a miroproject 
> for GSoC and Outreachy? It certainly looks like there are plenty of them.

That would be great.  It needs a bit of thinking, the required
change for each of them is quite small, and there are tons of them.
An ideal candidate for a microproject.

Adding it to the list of microproject ideas is a good #leftoverbits
as well.

>
> Thanks
>
> Phillip
>
>> Of course, we need to exclude messages like "the error code %d was
>> returned" and "you have a bug on line %d", but there seem to be real
>> errors in randomly selected hits from the "git grep" output, e.g.,
>> 
>> add-patch.c:						 _("Split into %d hunks."),
>> archive-zip.c:		return error(_("path too long (%d chars, SHA1: %s): %s"),
>> builtin/checkout.c:	    die(_("'%s' matched multiple (%d) remote tracking branches"),
>> builtin/credential-store.c:		die_errno(_("unable to get credential storage lock in %d ms"), timeout_ms);
>> builtin/describe.c:				_("found %i tags; gave up search at %s\n"),
>> builtin/fsck.c:		fprintf_ln(stderr, _("Checking connectivity (%d objects)"), max);
>> 
>> You can notice that I started from 'a' and stopped very early in 'b'
>> ;-).
>> 
>> Thanks.

```

## Kaartic Sivaraam, 2026-03-25 04:29

Subject: Re: [PATCH] remote: use plural-only message for diverged branch status
Message-ID: <CA+ARAtovu6FrCEfYRd0mRz_KChkXPr6s=Er0-uCcFqfYLVU+=A@mail.gmail.com>
URL: https://gitlist.dev/e/CA%2BARAtovu6FrCEfYRd0mRz_KChkXPr6s%3DEr0-uCcFqfYLVU%2B%3DA%40mail.gmail.com
In-Reply-To: <xmqqms07putp.fsf@gitster.g>

```
On Mon, Mar 16, 2026 at 10:37 PM Junio C Hamano <gitster@pobox.com> wrote:
>
> Phillip Wood <phillip.wood123@gmail.com> writes:
>
> >> But wouldn't that lead to an awkward conclusion, i.e., hits from
> >> "git grep '[^Q]_("[^"]*%[id]' \*.c" are potential bugs that need to
> >> be updated to use ngettext().
> >
> > I think it does - maybe we should suggest fixing these as a miroproject
> > for GSoC and Outreachy? It certainly looks like there are plenty of them.
>
> That would be great.  It needs a bit of thinking, the required
> change for each of them is quite small, and there are tons of them.
> An ideal candidate for a microproject.
>
> Adding it to the list of microproject ideas is a good #leftoverbits
> as well.
>

This has been added to the microprojects list now. Do check and
let us know in case it needs any tweaks.

  https://git.github.io/SoC-2026-Microprojects#fix-improper-pluralization-to-use-ngettext

Thanks.

--
Sivaraam

```
