Re: [BUG] branch renamed to 'HEAD'

2017-03-01 Thread Junio C Hamano
Jacob Keller writes: > I didn't find any problems besides what you had already outlined > before I started reading the series. It looks pretty much like I > thought it would. I like the idea of saying "I want X" rather than the > command returning "This was a Y" Yeah,

Re: [BUG] branch renamed to 'HEAD'

2017-02-28 Thread Jacob Keller
On Tue, Feb 28, 2017 at 4:06 AM, Jeff King wrote: > On Mon, Feb 27, 2017 at 07:53:02PM -0500, Jeff King wrote: > >> On Mon, Feb 27, 2017 at 04:33:36PM -0800, Junio C Hamano wrote: >> >> > A flag to affect the behaviour (as opposed to as a secondary >> > return value, like Peff's

Re: [BUG] branch renamed to 'HEAD'

2017-02-28 Thread Jeff King
On Mon, Feb 27, 2017 at 07:53:02PM -0500, Jeff King wrote: > On Mon, Feb 27, 2017 at 04:33:36PM -0800, Junio C Hamano wrote: > > > A flag to affect the behaviour (as opposed to as a secondary > > return value, like Peff's patch does) can be made to work. Perhaps > > a flag that says "keep the

Re: [BUG] branch renamed to 'HEAD'

2017-02-28 Thread Jacob Keller
On Mon, Feb 27, 2017 at 4:53 PM, Jeff King wrote: > On Mon, Feb 27, 2017 at 04:33:36PM -0800, Junio C Hamano wrote: > >> A flag to affect the behaviour (as opposed to as a secondary >> return value, like Peff's patch does) can be made to work. Perhaps >> a flag that says "keep

Re: [BUG] branch renamed to 'HEAD'

2017-02-27 Thread Jeff King
On Mon, Feb 27, 2017 at 04:33:36PM -0800, Junio C Hamano wrote: > A flag to affect the behaviour (as opposed to as a secondary > return value, like Peff's patch does) can be made to work. Perhaps > a flag that says "keep the input as is if the result is not a local > branch name" would pass an

Re: [BUG] branch renamed to 'HEAD'

2017-02-27 Thread Jacob Keller
On Mon, Feb 27, 2017 at 2:28 PM, Junio C Hamano wrote: > Jeff King writes: > >> I guess something like the patch below works, but I wonder if there is a >> less-horrible way to accomplish the same thing. > > I suspect that a less-horrible would be a lot more

Re: [BUG] branch renamed to 'HEAD'

2017-02-27 Thread Jeff King
On Mon, Feb 27, 2017 at 03:05:37PM -0800, Jacob Keller wrote: > > Perhaps with s/not_in_refs_heads/not_a_branch_name/ (or swapping > > polarity, "is_a_branch_name"), the resulting code may not be too > > hard to read? > > What about changing interpret-branch-name gains a flag to return a > fully

Re: [BUG] branch renamed to 'HEAD'

2017-02-27 Thread Jeff King
On Mon, Feb 27, 2017 at 02:28:09PM -0800, Junio C Hamano wrote: > Jeff King writes: > > > I guess something like the patch below works, but I wonder if there is a > > less-horrible way to accomplish the same thing. > > I suspect that a less-horrible would be a lot more

Re: [BUG] branch renamed to 'HEAD'

2017-02-27 Thread Junio C Hamano
Jacob Keller writes: > What about changing interpret-branch-name gains a flag to return a > fully qualified ref rather than returning just the name? That seems > like it would be more reasonable behavior. There are two kinds of callers to i-b-n. The ones that want a

Re: [BUG] branch renamed to 'HEAD'

2017-02-27 Thread Junio C Hamano
Jeff King writes: > I guess something like the patch below works, but I wonder if there is a > less-horrible way to accomplish the same thing. I suspect that a less-horrible would be a lot more intrusive. It would go like "interpret-branch-name only gives local branch name, and

Re: [BUG] branch renamed to 'HEAD'

2017-02-27 Thread Luc Van Oostenryck
On Mon, Feb 27, 2017 at 04:02:33AM -0500, Jeff King wrote: > Ugh. Actually, there are a few complications I found: > > 1. Checking "HEAD" afterwards means you can't actually have a branch > named "HEAD". Doing so is probably insane, but we probably really > _do_ want to just disallow

Re: [BUG] branch renamed to 'HEAD'

2017-02-27 Thread Jeff King
On Mon, Feb 27, 2017 at 03:01:58AM -0500, Jeff King wrote: > I do think the bug is in strbuf_check_branch_ref(), but it's hard for it > to do a better job. It needs to feed arbitrary expressions into > interpret_branch_name() to resolve things like "@{upstream}", "@{-1}", > "foo@{upstream}", etc.

Re: [BUG] branch renamed to 'HEAD'

2017-02-27 Thread Jeff King
On Mon, Feb 27, 2017 at 11:43:46AM +0530, Karthik Nayak wrote: > On Mon, Feb 27, 2017 at 10:22 AM, Luc Van Oostenryck > wrote: > > Hi, > > > > I just discover something which very much seems a bug to me > > while making an error in renaming a branch. > > The scenario

Re: [BUG] branch renamed to 'HEAD'

2017-02-27 Thread Jeff King
On Mon, Feb 27, 2017 at 02:49:15AM -0500, Jeff King wrote: > > > $ git branch -m -f orig @ > [...] > > Regardless of the original intent, I think it is wrong to convert "@" to > a branch named "HEAD". I think the bug is in strbuf_check_branch_ref(), > which blindly sticks "refs/heads/"

Re: [BUG] branch renamed to 'HEAD'

2017-02-26 Thread Luc Van Oostenryck
On Mon, Feb 27, 2017 at 11:43:46AM +0530, Karthik Nayak wrote: > Hello, > > Thanks for reporting, but I don't think it is a bug. > > On Mon, Feb 27, 2017 at 10:22 AM, Luc Van Oostenryck > wrote: > > Hi, > > > > I just discover something which very much seems a bug

Re: [BUG] branch renamed to 'HEAD'

2017-02-26 Thread Karthik Nayak
Hello, Thanks for reporting, but I don't think it is a bug. On Mon, Feb 27, 2017 at 10:22 AM, Luc Van Oostenryck wrote: > Hi, > > I just discover something which very much seems a bug to me > while making an error in renaming a branch. > The scenario is the

[BUG] branch renamed to 'HEAD'

2017-02-26 Thread Luc Van Oostenryck
Hi, I just discover something which very much seems a bug to me while making an error in renaming a branch. The scenario is the following: - I have a branch named 'orig' - I want to make some experimental changes on it: $ git checkout -b temp orig $ ... edit some files ...