Skip to contentSkip to conversation

checkout: Say “it” instead of “them” for one commit

PATCH In review Thomas Schneider 2 participants 3 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 checkout: Say “it” instead of “them” for one commit

When detached and checking out a branch again, git checkout warns about commit(s) that might get lost. It used to say “If you want to keep them […]” even for only one commit.

---
 builtin/checkout.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
builtin/checkout.c +9 -2
index 3e141fc..4aad49a 100644
@@ -743,10 +743,17 @@ static void suggest_reattach(struct commit *commit, struct rev_info *revs)
 
 	if (advice_detached_head)
 		fprintf(stderr,
-			_(
+			Q_(
+			/* The singular version */
+			"If you want to keep it by creating a new branch, "
+			"this may be a good time\nto do so with:\n\n"
+			" git branch <new-branch-name> %s\n\n",
+			/* The plural version */
 			"If you want to keep them by creating a new branch, "
 			"this may be a good time\nto do so with:\n\n"
-			" git branch <new-branch-name> %s\n\n"),
+			" git branch <new-branch-name> %s\n\n",
+			/* Give ngettext() the count */
+			lost),
 			find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV));
 }
 
Signature · 1 line
2.1.0
Reviewed-by on v1 1/1
#1 lore raw

Hi,

Quoted 5 lines · Thomas Schneider

When detached and checking out a branch again, git checkout warns about commit(s) that might get lost. It used to say “If you want to keep them […]” even for only one commit.

Makes sense.

[...]

Quoted 10 lines
builtin/checkout.c +3 -1
@@ -743,10 +743,17 @@ static void suggest_reattach(struct commit *commit, struct rev_info *revs)
 
 	if (advice_detached_head)
 		fprintf(stderr,
-			_(
+			Q_(
+			/* The singular version */
+			"If you want to keep it by creating a new branch, "

builtin/checkout.c static void suggest_reattach(struct commit *commit, struct rev_info *revs) · line 757

Quoted 10 lines
builtin/checkout.c +6 -1
+			"this may be a good time\nto do so with:\n\n"
+			" git branch <new-branch-name> %s\n\n",
+			/* The plural version */
 			"If you want to keep them by creating a new branch, "
 			"this may be a good time\nto do so with:\n\n"
-			" git branch <new-branch-name> %s\n\n"),
+			" git branch <new-branch-name> %s\n\n",
+			/* Give ngettext() the count */
+			lost),
 			find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV));

The comments for /* singular */, /* plural */, and /* count */ seem redundant and distracting to me, but since we have the same comments a few lines before, keeping it consistent is the right thing to do.

For what it's worth,

#2 lore raw

Junio –

I see you changed my commit message a bit, but some mistakes seem to have slipped in:

Quoted 1 line

checkout: call a single commit “it” instead of “th

“them” was cut off, including the trailing quotation mark. […]

Quoted 1 line

them ..."” even for only one commit.

Two quotation marks?

I always use the “right” quotation marks instead of " or ' and “…” instead of “...”, should I have used the latter ones?

Thanks,
Thomas