git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alex Riesen <raa.lkml@gmail.com>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: git@vger.kernel.org, Junio C Hamano <junkio@cox.net>
Subject: Re: [PATCH] Extend "checkout --track" DWIM to support more cases
Date: Wed, 20 Aug 2008 22:29:52 +0200	[thread overview]
Message-ID: <20080820202952.GH16626@blimp.local> (raw)
In-Reply-To: <alpine.DEB.1.00.0808202213340.24820@pacific.mpi-cbg.de.mpi-cbg.de>

Johannes Schindelin, Wed, Aug 20, 2008 22:16:19 +0200:
> > 
> > No. It strips refs/ OR remotes/ (because of prefixcmp with argv[0]).
> > And I still wanted refs/<namespace>/something...
> 
> Yes, you are correct.  However, to fix my thinko, I deem this preferable:
> 
> -- snipsnap --
> 
>  builtin-checkout.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/builtin-checkout.c b/builtin-checkout.c
> index e95eab9..2a076cf 100644
> --- a/builtin-checkout.c
> +++ b/builtin-checkout.c
> @@ -448,8 +448,10 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
>  		if (!argc || !strcmp(argv[0], "--"))
>  			die ("--track needs a branch name");
>  		slash = strchr(argv[0], '/');
> -		if (slash && !prefixcmp(argv[0], "refs/"))
> -			slash = strchr(slash + 1, '/');
> +		if (slash && !prefixcmp(argv[0], "refs/")) {
> +			argv[0] = slash + 1;
> +			slash = strchr(argv[0], '/');
> +		}

Yes, I agree (and its shorter). The git-checkout manpage can be
improved, too (no DWIM is obvious, except may be for the implementor).

  reply	other threads:[~2008-08-20 20:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-20 18:50 [PATCH] Extend "checkout --track" DWIM to support more cases Alex Riesen
2008-08-20 19:52 ` Johannes Schindelin
2008-08-20 20:04   ` Alex Riesen
2008-08-20 20:16     ` Johannes Schindelin
2008-08-20 20:29       ` Alex Riesen [this message]
2008-08-20 22:22         ` Junio C Hamano
2008-08-21 17:23           ` Alex Riesen
2008-08-22  5:54             ` Junio C Hamano
2008-08-22  9:08               ` Alex Riesen
2008-08-22 21:17                 ` Junio C Hamano
2008-08-22 23:33             ` Jay Soffian

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=20080820202952.GH16626@blimp.local \
    --to=raa.lkml@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /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).