On Sun, Jan 24, 2016 at 06:26:50PM -0800, Junio C Hamano wrote: > Jeff King <peff@xxxxxxxx> writes: > > > Yeah, "strip=2" would also get the job done, and extends more naturally > > to the branch case. > > > > To be honest, I cannot imagine anybody using anything _but_ strip=2... > > I 100% agree, and I do consider this to be internal implementation > detail for the listing modes of "tag" (and "branch"), which may be > exposed to the user (by documenting that %(refname:X) is used by > default), so perhaps even the flexibility of strip=2 is unwanted. > > I know what "remove-standard-prefix" is way too long for the value > of X above, but then we can say "the command will error out if you > allow your for-each-ref invocation to step outside of the area that > has standard prefix to be removed." without having to worry about > "what is the sensible thing to do when the prefixes are not what we > expect (too short for strip=2 or no match for short=refs/tags/)". I'm not sure "remove-standard-prefix" doesn't open its own questions. Like "what are the standard prefixes?". If we are going to go with "remove a prefix", I really don't think "remove if present" is too complicated a set of semantics (as opposed to "error out" you mentioned above). I do like "strip=<n>" for its simplicity (it's easy to explain), and the fact that it will probably handle the git-branch case for us. The only open question is what to do if there are fewer components, but I really think any of the 4 behaviors I gave earlier would be fine. Eric' globbing suggestion is simpler for the error case (as a prefix, it can be "remove if present"), but I think introducing globbing in general opens up too many corner cases (e.g., does "*" match "/", is "**" supported, etc). -Peff -- 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