Thread (1 message) 1 message, 1 author, 2017-03-23

Re: [PATCH] refs.c: use skip_prefix() in prettify_refname()

From: Junio C Hamano <hidden>
Date: 2017-03-23 20:06:03

Jeff King [off-list ref] writes:
On Thu, Mar 23, 2017 at 12:33:06PM -0700, Junio C Hamano wrote:
quoted
quoted
quoted
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 ;-)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help