Jacob Keller <jacob.keller@xxxxxxxxx> writes: > On Wed, Jan 18, 2017 at 12:04 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote: > >> I agree that we cannot short-cut on the first match to make sure >> that the outcome is stable, but I wondered what should be shown when >> we do have multiple matches. Say I gave >> >> --refs="v*" --refs="refs/tags/v1.*" >> >> and refs/tags/v1.0 matched. The above code would say we can >> abbreviate. >> >> What is the reason behind this design decision? Is it because it is >> clear that the user shows her willingness to accept more compact >> form by having --refs="v*" that would allow shortening? If that is >> the case, I think I agree with the reasoning. But we probably want >> to write it down somewhere, because another reasoning, which may >> also be valid, would call for an opposite behaviour (i.e. the more >> specific --refs="refs/tags/v1.*" also matched, so let's show that >> fact by not shortening). > > I'm not sure which reasoning makes most sense. Any other opinions? FWIW, I do think that the design decision to declare that it can be abbreviated if the ref matches at least one short pattern makes sense, and I am guessing (because you didn't answer when asked what _your_ reasoning behind the code was) that you are in agreement. I just want it to be spelled out probably as in-code comment, so that people who later come to this part of the code know why it was designed that way. And they can disagree and change it if the end result is better---I just want to make sure that they can understand what they are disagreeing when it happens, as opposed to them scratching their head saying "we do not know why it was chosen to be done this way, let's make a random change to make it behave differently".