Re: [PATCH v4] Introduce %<branch> as shortcut to the tracked branch

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

 



On Fri, 20 Mar 2009, Junio C Hamano wrote:

An most obvious one is that "git checkout branchname" and "git checkout
refs/heads/branchname" behave differently.  You cannot checkout a branch
called %master after this patch goes in.

Just be honest and say "You may have a branch whose name begins with a '%'
and you cannot refer to it anymore in certain contexts.  Too bad.  Don't
do it next time you create a new branch".  I _can_ buy that argument.

It however asks for a sane escape hatch.  You cannot "fix" such branch
names in most obvious ways (if you could, that would be a bug in this %
feature).

(1) git branch -m %master percent-master

    We would end up renaming what master tracks to new name.

(2) git branch percent-master refs/heads/%master; git branch -d %master

    The first part is a good try, but the latter deletes what master
    tracks.

How about adding a generic escape hatch, that would cover this and future extensions?

Let a ref that starts with a single quote be taken as given and not processed. You have to escape it to get it past the shell, but that makes it rather unlikely that anyone has used a name that starts with a quote - and if they have you can still use this mechanism to rename it.

So now (1) above could be written:

 git branch -m "'%master" percent-master

and other commands, such as

 git branch -d "'%master"

or

 git checkout "'%master"

would also do the right thing (i.e. use refs/heads/%master as a branch).

--
Julian

 ---
Stewie Griffin:  [looking in the fridge for a drink] Soda... purple stuff... Sunny D, all right!
--
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