All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: "René Scharfe" <l.s.r@web.de>,
	"SZEDER Gábor" <szeder.dev@gmail.com>,
	git@vger.kernel.org
Subject: Re: [PATCH] refs.c: use skip_prefix() in prettify_refname()
Date: Thu, 23 Mar 2017 13:05:24 -0700	[thread overview]
Message-ID: <xmqqmvcbbvy3.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20170323193919.twwfwdoulo2hjz24@sigill.intra.peff.net> (Jeff King's message of "Thu, 23 Mar 2017 15:39:19 -0400")

Jeff King <peff@peff.net> writes:

> On Thu, Mar 23, 2017 at 12:33:06PM -0700, Junio C Hamano wrote:
>
>> >> Nice, but why add the "if" when it's doing nothing?
>> >
>> > It's short-circuiting in the conditional.
>> 
>> I think René meant this:
>> 
>>      /* just for side effects */
>>      skip_prefix(name, "refs/heads/", &name) ||
>>      skip_prefix(name, "refs/tags/", &name) ||
>>      skip_prefix(name, "refs/remotes/", &name);
>> 
>>      return name;
>> 
>> which still short-sircuits, even though I do think it looks
>> strange; "correct but strange".
>
> And it causes the compiler to complain that the value is not used.

Ahh.  OK.

In any case, I've queued the original with "if", which shouldn't
have that problem ;-)

  reply	other threads:[~2017-03-23 20:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-23 15:50 [PATCH] refs.c: use skip_prefix() in prettify_refname() SZEDER Gábor
2017-03-23 19:18 ` René Scharfe
2017-03-23 19:23   ` Jeff King
2017-03-23 19:31     ` Stefan Beller
2017-03-23 19:33     ` Junio C Hamano
2017-03-23 19:36       ` René Scharfe
2017-03-23 19:40         ` Junio C Hamano
2017-03-23 19:39       ` Jeff King
2017-03-23 20:05         ` Junio C Hamano [this message]
2017-03-23 20:06         ` SZEDER Gábor
2017-03-23 20:06         ` René Scharfe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqmvcbbvy3.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=l.s.r@web.de \
    --cc=peff@peff.net \
    --cc=szeder.dev@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.