git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephan Beyer <s-beyer@gmx.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Fix git-show-branch --current when not on a branch
Date: Tue, 27 May 2008 02:20:51 +0200	[thread overview]
Message-ID: <20080527002051.GA13683@leksak.fem-net> (raw)
In-Reply-To: <7vhcck4t6z.fsf@gitster.siamese.dyndns.org>

[-- Attachment #1: Type: text/plain, Size: 1286 bytes --]

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@gmx.net>, PGP 0x6EDDD207FCC5040F

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

      reply	other threads:[~2008-05-27  0:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-23 23:00 [PATCH] Fix git-show-branch --current when not on a branch Stephan Beyer
2008-05-26 12:09 ` Stephan Beyer
2008-05-26 22:05 ` Junio C Hamano
2008-05-27  0:20   ` Stephan Beyer [this message]

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=20080527002051.GA13683@leksak.fem-net \
    --to=s-beyer@gmx.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).