Re: [PATCH] git commit: Repaint the output format bikeshed (again)
From: Jeff King <hidden>
Date: 2016-06-15 22:45:26
On Thu, Oct 02, 2008 at 07:40:28AM +0200, Andreas Ericsson wrote:
No sign-off.
Sorry, mistakenly omitted. Signed-off-by: Jeff King <redacted>
quoted
+ 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