Re: [PATCH v15 12/27] bisect--helper: `get_terms` & `bisect_terms` shell function in C
- From
Stephan Beyer <s-beyer@gmx.net>
- Date
- Dec 6, 2016, 23:05 UTC
- Message-ID
- <a492fb63-3642-1f97-4668-a927352169f9@gmx.net>
- In-Reply-To
- <CAFZEwPNZCSGzeabHMH6wihz-51OUMMtnBMsffwJJVm9G8Fn=tw@mail.gmail.com>
Hey Pranit,
On 12/06/2016 10:14 PM, Pranit Bauva wrote:
Show 12 quoted lines
>>> +
>>> + if (argc == 0) {
>>> + printf(_("Your current terms are %s for the old state\nand "
>>> + "%s for the new state.\n"), terms->term_good,
>>> + terms->term_bad);
>>
>> Very minor: It improves the readability if you'd split the string after
>> the \n and put the "and "in the next line.
>
> Ah. This is because of the message. If I do the other way, then it
> won't match the output in one of the tests in t/t6030 thus, I am
> keeping it that way in order to avoid modifying the file t/t6030.I think I was unclear here. I was referring to the coding/layouting style, not to the string. I mean like writing:
printf(_("Your current terms are %s for the old state\n"
"and "%s for the new state.\n"),
terms->term_good, terms->term_bad);The string fed to _() is the same, but it is split in a different (imho more readable) way: after the "\n", not after the "and ".
Show 10 quoted lines
>>> + die(_("invalid argument %s for 'git bisect "
>>> + "terms'.\nSupported options are: "
>>> + "--term-good|--term-old and "
>>> + "--term-bad|--term-new."), argv[i]);
>>
>> Hm, "return error(...)" and "die(...)" seems to be quasi-equivalent in
>> this case. Because I am always looking from a library perspective, I'd
>> prefer "return error(...)".
>
> I should use return error()When you reroll your patches, please also check if you always put _() around your error()s ;) (Hmmm... On the other hand, it might be arguable if translations are useful for errors that only occur when people hack git-bisect or use the bisect--helper directly... This makes me feel like all those errors should be prefixed by some "BUG: " marker since the ordinary user only sees them when there is a bug. But I don't feel in the position to decide or recommend such a thing, so it's just a thought.)
~Stephan