Re: [PATCH] git commit: Repaint the output format bikeshed (again)
- From
Jeff King <peff@peff.net>
- Date
- Oct 2, 2008, 21:13 UTC
- Message-ID
- <20081002211309.GB29480@coredump.intra.peff.net>
- In-Reply-To
- <48E45ECC.8070104@op5.se>
On Thu, Oct 02, 2008 at 07:40:28AM +0200, Andreas Ericsson wrote:
> No sign-off.
Sorry, mistakenly omitted.
Signed-off-by: Jeff King <peff@peff.net>
Show 12 quoted lines
>> + printf("[%s%s]: created ",
>> + !prefixcmp(head, "refs/heads/") ?
>> + head + 11 :
>> + !strcmp(head, "HEAD") ?
>> + "detached HEAD" :
>> + head,
>> + initial_commit ? " (root-commit)" : "");
>>
>
> Personally, I'm not overly fond of things like
> something ? yay : nay_but_try ? worked_now : still_no_go
> since I find them hard to read without thinking a lot.Hmm, I find them more readable. :) And often easier to visually see that no matter what happens, the result has _some_ value (whereas with if/else, you have to make sure that all branchs set the value). But I am happy to change it to:
const char *branch; ...
if (!prefixcmp(head, "refs/heads/"))
branch = head + 11;
else if (!strcmp(head, "HEAD"))
branch = "detached HEAD";
else
branch = head;However, I found your mail somewhat unexpected. Rather than comments on the code, I expected rather "yes, I do like this better" or "no, I think we should go with the other one." But maybe you are just sick of weighing in. ;)
-Peff