threads / discuss / 38215

About refs refs/heads/+...

Subject: About refs refs/heads/+...

## tl;dr

3 messages between Dec 21, 2014 and Dec 22, 2014.

replies: 2people: 2as markdown or json

Duy Nguyen· Dec 21, 2014, 10:58 UTC · lore

I accidentally created a branch whose name starts with "+". Everything went ok until I pushed it because "+" is interpreted as forced refspec (e.g. "git push somewhere +wip"). Using full ref names would avoid ambiguity. The corner case of this is where the branch name is simply "+". Then refspec "+:" will be interpreted completely different from what the user wants. I wonder if we could do something better:

 - forbid "/+" in ref names (too strong?)
 - some heuristics to detect "+:" and refuse it if ref "+" exists.
heuristics to hint the user about full ref name after we fail to match
refspec because we misinterpret "+"
 - improve refspec matching code to detect ambiguation and force using
full ref name.
-- 
Duy
Junio C Hamano· Dec 21, 2014, 18:40 UTC · re: Duy Nguyen · lore

Re: About refs refs/heads/+...

Duy Nguyen <pclouds@gmail.com> writes:
Show 6 quoted lines
> I accidentally created a branch whose name starts with  "+".
> Everything went ok until I pushed it  because "+" is interpreted as
> forced refspec (e.g. "git push somewhere +wip"). Using full ref names
> would avoid ambiguity. The corner case of this is where the branch
> name is simply "+". Then refspec "+:" will be interpreted completely
> different from what the user wants.

Using full ref names does not avoid ambiguity in that case? What is a push refspec with an empty right-hand-side supposed to do in the first place anyway?

Duy Nguyen· Dec 22, 2014, 02:15 UTC · re: Junio C Hamano · lore

Re: About refs refs/heads/+...

On Mon, Dec 22, 2014 at 1:40 AM, Junio C Hamano <gitster@pobox.com> wrote:
> What is a push refspec with an empty right-hand-side supposed to do in
> the first place anyway?
Error out. My bad.
-- 
Duy

← back to recent threads