Re: [PATCH] git commit: Repaint the output format bikeshed (again)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxx>

>> +	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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux