Re: [PATCH] Fix git-show-branch --current when not on a branch

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

 



Hi,

> >  builtin-show-branch.c |    3 +--
> >  1 files changed, 1 insertions(+), 2 deletions(-)
> >
> > diff --git a/builtin-show-branch.c b/builtin-show-branch.c
> > index 019abd3..412eba0 100644
> > --- a/builtin-show-branch.c
> > +++ b/builtin-show-branch.c
> > @@ -782,8 +782,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
> >  				has_head++;
> >  		}
> >  		if (!has_head) {
> > -			int pfxlen = strlen("refs/heads/");
> > -			append_one_rev(head + pfxlen);
> > +			append_one_rev(head);
> 
> This changes the output for normal case.

It does?  How?

I cite my commit message:
> [...] So append_one_rev() operates
> on "refs/heads/foo" instead of "foo", which still works.
> But now it also operates correctly on "HEAD".

And I still think it's true.
I diff'ed the outputs of
	git-show-branch --current
AND (just to go sure)
	git-show-branch
on git.next
before and after the patch:
	No difference.

> +			int offset = !prefixcmp(head, "refs/heads/") ? 11 : 0;

Your version is the intuitive change and, of course, right,
but I don't see why we should do the prefixcmp() when it does
not change the resulting behavior in any way.

Regards,
  Stephan

-- 
Stephan Beyer <s-beyer@xxxxxxx>, PGP 0x6EDDD207FCC5040F

Attachment: signature.asc
Description: Digital signature


[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