Re: [PATCH] Extend "checkout --track" DWIM to support more cases

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

 



Hi,

On Wed, 20 Aug 2008, Alex Riesen wrote:

> The code handles additionally "refs/remotes/<something>/name",
> "remotes/<something>/name", and "refs/<namespace>/name".
> Test cases included.
> 
> Signed-off-by: Alex Riesen <raa.lkml@xxxxxxxxx>
> ---
> 
> Johannes has likable ideas :)
> 
>  builtin-checkout.c |   20 +++++++++++++++-----
>  t/t7201-co.sh      |   23 ++++++++++++++++++++++-
>  2 files changed, 37 insertions(+), 6 deletions(-)
> 
> diff --git a/builtin-checkout.c b/builtin-checkout.c
> index e95eab9..20466e2 100644
> --- a/builtin-checkout.c
> +++ b/builtin-checkout.c
> @@ -447,11 +447,21 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
>  		char *slash;
>  		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], "remotes/"))
> -			slash = strchr(slash + 1, '/');

Why is this not enough?  It strips refs/ if there is one, and remotes/ if 
there is one (possibly after stripping refs/).  No?

Puzzled,
Dscho
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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