Re: [PATCH] remote: prefer exact matches when using refspecs

2018-07-31 Thread Junio C Hamano
Jonathan Tan writes: > This looks good to me. I've checked that refname_match (and > branch_merge_matches(), which returns the result of refname_match() > directly) is only used in "if" contexts, so making it return a value > other than 1 is fine. Yes, the log message should say that existing

Re: [PATCH] remote: prefer exact matches when using refspecs

2018-07-31 Thread Jonathan Tan
> That is, something like this, perhaps. The resulting behaviour > should match how "git rev-parse X" would give precedence to tag X > over branch X by going this route. What do you think? [snip] > static const struct ref *find_ref_by_name_abbrev(const struct ref *refs, > const char *name) >

Re: [PATCH] remote: prefer exact matches when using refspecs

2018-07-31 Thread Junio C Hamano
Junio C Hamano writes: > In order to resolve this correctly with the precedence rules, I > think you need to make refname_match() return the precedence number > (e.g. give 1 to "%.*s", 2 to "refs/%.*s", etc., using the index in > ref_rev_parse_rules[] array), and make this loop keep track of the

Re: [PATCH] remote: prefer exact matches when using refspecs

2018-07-31 Thread Junio C Hamano
Jonathan Tan writes: > When matching a non-wildcard LHS of a refspec against a list of refs, > find_ref_by_name_abbrev() returns the first ref that matches using the > DWIM rules used by refname_match() in refs.c, even if an exact match > occurs later in the list of refs. When you have

Re: [PATCH] remote: prefer exact matches when using refspecs

2018-07-31 Thread Jonathan Nieder
Hi, Jonathan Tan wrote: > When matching a non-wildcard LHS of a refspec against a list of refs, > find_ref_by_name_abbrev() returns the first ref that matches using the > DWIM rules used by refname_match() in refs.c, even if an exact match > occurs later in the list of refs. > > This causes