{"thread":{"id":"42205","subject":"bug: incorrect plurality of \"commit\" in git status","startedAt":"2016-05-02T22:46:10Z","lastAt":"2016-05-03T09:32:19Z","messageCount":8,"participants":["Alfonsogonzalez, Ernesto (GE Digital)","Nguyễn Thái Ngọc Duy","Stefan Beller","Duy Nguyen","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"285228","messageId":"2A734D896A45164C887E476E942BF4F9B5F721@CINMBCNA09.e2k.ad.ge.com","threadId":"42205","inReplyTo":null,"subject":"bug: incorrect plurality of \"commit\" in git status","fromName":"Alfonsogonzalez, Ernesto (GE Digital)","fromEmail":"ernesto.alfonsogonzalez@ge.com","sentAt":"2016-05-02T22:46:10Z","receivedAt":"2016-05-02T22:46:10Z","isPatch":false,"sender":{"key":"ernesto.alfonsogonzalez@ge.com","avatar":null},"body":"\n[debian-vm]$ gt\nOn branch feat/junit-test\nYour branch and 'origin/feat/junit-test' have diverged,\nand have 19 and 1 different commit each, respectively.\n\n\n\nShould be \"commits\""},{"id":"285231","messageId":"1462234350-30902-1-git-send-email-pclouds@gmail.com","threadId":"42205","inReplyTo":"2A734D896A45164C887E476E942BF4F9B5F721@CINMBCNA09.e2k.ad.ge.com","subject":"[PATCH] remote.c: specify correct plural form in \"commit diverge\" message","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2016-05-03T00:12:30Z","receivedAt":"2016-05-03T00:12:30Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"We need to count both \"ours\" and \"theirs\" commits when selecting plural\nform for this message. Note that even though in this block, both ours\nand theirs must be positive (i.e. can't be in singular form), we still\nkeep Q_(singular, plural) because languages other than English may have\nmore than one plural form.\n\nReported-by: Alfonsogonzalez, Ernesto (GE Digital) <ernesto.alfonsogonzalez@ge.com>\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n remote.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/remote.c b/remote.c\nindex 28fd676..212426e 100644\n--- a/remote.c\n+++ b/remote.c\n@@ -2108,7 +2108,7 @@ int format_tracking_info(struct branch *branch, struct strbuf *sb)\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   theirs),\n+\t\t\t   ours + theirs),\n \t\t\tbase, ours, theirs);\n \t\tif (advice_status_hints)\n \t\t\tstrbuf_addf(sb,\n-- \n2.8.0.rc0.210.gd302cd2\n"},{"id":"285232","messageId":"CAGZ79kayCBNn8e5TzD+zhPEopOVTvsTUfy=_9UGP43vktsdFLQ@mail.gmail.com","threadId":"42205","inReplyTo":"1462234350-30902-1-git-send-email-pclouds@gmail.com","subject":"Re: [PATCH] remote.c: specify correct plural form in \"commit diverge\" message","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2016-05-03T00:16:13Z","receivedAt":"2016-05-03T00:16:13Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Mon, May 2, 2016 at 5:12 PM, Nguyễn Thái Ngọc Duy <pclouds@gmail.com> wrote:\n> We need to count both \"ours\" and \"theirs\" commits when selecting plural\n> form for this message. Note that even though in this block, both ours\n> and theirs must be positive (i.e. can't be in singular form), we still\n> keep Q_(singular, plural) because languages other than English may have\n> more than one plural form.\n>\n> Reported-by: Alfonsogonzalez, Ernesto (GE Digital) <ernesto.alfonsogonzalez@ge.com>\n> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n> ---\n>  remote.c | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/remote.c b/remote.c\n> index 28fd676..212426e 100644\n> --- a/remote.c\n> +++ b/remote.c\n> @@ -2108,7 +2108,7 @@ int format_tracking_info(struct branch *branch, struct strbuf *sb)\n>                            \"Your branch and '%s' have diverged,\\n\"\n>                                \"and have %d and %d different commits each, \"\n>                                \"respectively.\\n\",\n> -                          theirs),\n> +                          ours + theirs),\n\nI think it needs to be max(ours, theirs)\n\n    \"Your branch and '%s' have diverged,\\n\"\n    \"and have 1 and 1 different commit each, \"\n\nso singular for that too, no?\n\n\n>                         base, ours, theirs);\n>                 if (advice_status_hints)\n>                         strbuf_addf(sb,\n> --\n> 2.8.0.rc0.210.gd302cd2\n>\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n"},{"id":"285234","messageId":"CACsJy8C0mFfHQ+GSdJyXLc=SArnxKfZCFV7LJkoqEPs0ekzDZg@mail.gmail.com","threadId":"42205","inReplyTo":"CAGZ79kayCBNn8e5TzD+zhPEopOVTvsTUfy=_9UGP43vktsdFLQ@mail.gmail.com","subject":"Re: [PATCH] remote.c: specify correct plural form in \"commit diverge\" message","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2016-05-03T00:20:27Z","receivedAt":"2016-05-03T00:20:27Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Tue, May 3, 2016 at 7:16 AM, Stefan Beller <sbeller@google.com> wrote:\n> On Mon, May 2, 2016 at 5:12 PM, Nguyễn Thái Ngọc Duy <pclouds@gmail.com> wrote:\n>> We need to count both \"ours\" and \"theirs\" commits when selecting plural\n>> form for this message. Note that even though in this block, both ours\n>> and theirs must be positive (i.e. can't be in singular form), we still\n>> keep Q_(singular, plural) because languages other than English may have\n>> more than one plural form.\n>>\n>> Reported-by: Alfonsogonzalez, Ernesto (GE Digital) <ernesto.alfonsogonzalez@ge.com>\n>> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n>> ---\n>>  remote.c | 2 +-\n>>  1 file changed, 1 insertion(+), 1 deletion(-)\n>>\n>> diff --git a/remote.c b/remote.c\n>> index 28fd676..212426e 100644\n>> --- a/remote.c\n>> +++ b/remote.c\n>> @@ -2108,7 +2108,7 @@ int format_tracking_info(struct branch *branch, struct strbuf *sb)\n>>                            \"Your branch and '%s' have diverged,\\n\"\n>>                                \"and have %d and %d different commits each, \"\n>>                                \"respectively.\\n\",\n>> -                          theirs),\n>> +                          ours + theirs),\n>\n> I think it needs to be max(ours, theirs)\n>\n>     \"Your branch and '%s' have diverged,\\n\"\n>     \"and have 1 and 1 different commit each, \"\n>\n> so singular for that too, no?\n\nI thought that would be \"1 and 1 commits\". English is complicated :-D\nI don't think Q_() is prepared to deal with this, other languages may\nhave different interpretation of \"x and y\" too. But we can at least\nmake the English version right.\n-- \nDuy\n"},{"id":"285241","messageId":"20160503042008.GB30529@sigill.intra.peff.net","threadId":"42205","inReplyTo":"CACsJy8C0mFfHQ+GSdJyXLc=SArnxKfZCFV7LJkoqEPs0ekzDZg@mail.gmail.com","subject":"Re: [PATCH] remote.c: specify correct plural form in \"commit diverge\" message","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-05-03T04:20:08Z","receivedAt":"2016-05-03T04:20:08Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, May 03, 2016 at 07:20:27AM +0700, Duy Nguyen wrote:\n\n> > I think it needs to be max(ours, theirs)\n> >\n> >     \"Your branch and '%s' have diverged,\\n\"\n> >     \"and have 1 and 1 different commit each, \"\n> >\n> > so singular for that too, no?\n> \n> I thought that would be \"1 and 1 commits\". English is complicated :-D\n> I don't think Q_() is prepared to deal with this, other languages may\n> have different interpretation of \"x and y\" too. But we can at least\n> make the English version right.\n\nYes, it should still be \"1 and 1 commits\", I think. An actual human\nwould probably say something like \"and each has %d commit(s)\" when the\ntwo values are the same, though.\n\nNote that I do not think the singular case can ever trigger with your\nnew code. We know that both \"ours\" and \"theirs\" are non-zero to get to\nthis message, which means \"ours + theirs\" must be at least 2 (barring\nnegative commit counts, of course :) ).\n\nSo you could probably replace the Q_() with just a _().\n\n-Peff\n"},{"id":"285243","messageId":"CACsJy8Bqs5dnKc=VPeuqPZ4OUWVdhYNbewWc5rs-R3FGoZuQ5g@mail.gmail.com","threadId":"42205","inReplyTo":"20160503042008.GB30529@sigill.intra.peff.net","subject":"Re: [PATCH] remote.c: specify correct plural form in \"commit diverge\" message","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2016-05-03T04:43:41Z","receivedAt":"2016-05-03T04:43:41Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Tue, May 3, 2016 at 11:20 AM, Jeff King <peff@peff.net> wrote:\n> Note that I do not think the singular case can ever trigger with your\n> new code. We know that both \"ours\" and \"theirs\" are non-zero to get to\n> this message, which means \"ours + theirs\" must be at least 2 (barring\n> negative commit counts, of course :) ).\n>\n> So you could probably replace the Q_() with just a _().\n\nProblem is there are languages with more than one plural form (and the\nwinner is Arabic with six(!) forms [1]). So even if singular form is\nnever used, I think we still should stick to Q_().\n\n[1] https://www.gnu.org/software/gettext/manual/html_node/Plural-forms.html\n-- \nDuy\n"},{"id":"285245","messageId":"20160503044805.GB32259@sigill.intra.peff.net","threadId":"42205","inReplyTo":"CACsJy8Bqs5dnKc=VPeuqPZ4OUWVdhYNbewWc5rs-R3FGoZuQ5g@mail.gmail.com","subject":"Re: [PATCH] remote.c: specify correct plural form in \"commit diverge\" message","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-05-03T04:48:06Z","receivedAt":"2016-05-03T04:48:06Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, May 03, 2016 at 11:43:41AM +0700, Duy Nguyen wrote:\n\n> On Tue, May 3, 2016 at 11:20 AM, Jeff King <peff@peff.net> wrote:\n> > Note that I do not think the singular case can ever trigger with your\n> > new code. We know that both \"ours\" and \"theirs\" are non-zero to get to\n> > this message, which means \"ours + theirs\" must be at least 2 (barring\n> > negative commit counts, of course :) ).\n> >\n> > So you could probably replace the Q_() with just a _().\n> \n> Problem is there are languages with more than one plural form (and the\n> winner is Arabic with six(!) forms [1]). So even if singular form is\n> never used, I think we still should stick to Q_().\n\nNeat, I didn't know Q_() could handle that (I guess you are stuck\nspecifying only the two cases in the untranslated form, but the PO files\ncan do magic in the backend).\n\nIt would be nice if there were some way to mark it as \"this string will\nnever be shown\", or \"will always be >= 2\" as a hint for translators. I\nguess those can go in a specially-formatted comment.\n\n-Peff\n"},{"id":"285271","messageId":"CACsJy8B2i1ef57xgrRAYkkpWL1-Lz5O7_Zcje1pJ6eLuMry18w@mail.gmail.com","threadId":"42205","inReplyTo":"20160503044805.GB32259@sigill.intra.peff.net","subject":"Re: [PATCH] remote.c: specify correct plural form in \"commit diverge\" message","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2016-05-03T09:32:19Z","receivedAt":"2016-05-03T09:32:19Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Tue, May 3, 2016 at 11:48 AM, Jeff King <peff@peff.net> wrote:\n> On Tue, May 03, 2016 at 11:43:41AM +0700, Duy Nguyen wrote:\n>\n>> On Tue, May 3, 2016 at 11:20 AM, Jeff King <peff@peff.net> wrote:\n>> > Note that I do not think the singular case can ever trigger with your\n>> > new code. We know that both \"ours\" and \"theirs\" are non-zero to get to\n>> > this message, which means \"ours + theirs\" must be at least 2 (barring\n>> > negative commit counts, of course :) ).\n>> >\n>> > So you could probably replace the Q_() with just a _().\n>>\n>> Problem is there are languages with more than one plural form (and the\n>> winner is Arabic with six(!) forms [1]). So even if singular form is\n>> never used, I think we still should stick to Q_().\n>\n> Neat, I didn't know Q_() could handle that (I guess you are stuck\n> specifying only the two cases in the untranslated form, but the PO files\n> can do magic in the backend).\n>\n> It would be nice if there were some way to mark it as \"this string will\n> never be shown\", or \"will always be >= 2\" as a hint for translators. I\n> guess those can go in a specially-formatted comment.\n\nYep, that's the only way I know. But it's probably not good for this\npurpose. Imagine if the code is moved around a bit and this exact\nstring can take n == 1 (probably not given the \"x _and_ y commits\"\npattern) then we need to tell all translators (optional hints are not\nenough) to translate the \"n < 2\" part or empty string can be printed.\nAnd at least in _() case, empty string is an indication of\nuntranslated messages, the translator would just translate anyway so\nhe/she can identify new messages easier.\n\nOn the practical side, since\nthis string has been here for a long time, it's been already\ntranslated in all supported languages (except it.po), hinting now\nwon't help much (besides it.po)\n-- \nDuy\n"}]}