Re: [PATCH 4/8] interpret_branch_name: allow callers to restrict expansions

2017-02-28 Thread Jeff King
On Tue, Feb 28, 2017 at 12:27:45PM -0800, Junio C Hamano wrote: > Jeff King writes: > > > The original purpose of interpret_branch_name() was to be used by > > get_sha1() in resolving refs. As such, some of its expansions may > > point to refs outside of the local "refs/heads" namespace. > > I

Re: [PATCH 4/8] interpret_branch_name: allow callers to restrict expansions

2017-02-28 Thread Junio C Hamano
Jeff King writes: > The original purpose of interpret_branch_name() was to be used by > get_sha1() in resolving refs. As such, some of its expansions may > point to refs outside of the local "refs/heads" namespace. I am not sure the reference to "get_sha1()" is entirely correct. Until it was r

Re: [PATCH 4/8] interpret_branch_name: allow callers to restrict expansions

2017-02-28 Thread Jeff King
On Tue, Feb 28, 2017 at 07:23:38AM -0500, Jeff King wrote: > > -int interpret_branch_name(const char *name, int namelen, struct strbuf > > *buf) > > +int interpret_branch_name(const char *name, int namelen, struct strbuf > > *buf, > > + unsigned allowed) > > { > > char *

Re: [PATCH 4/8] interpret_branch_name: allow callers to restrict expansions

2017-02-28 Thread Jeff King
On Tue, Feb 28, 2017 at 07:14:34AM -0500, Jeff King wrote: > However, out-parameters make calling interface somewhat > cumbersome. Instead, let's do the opposite: let the caller > tell us which elements to expand. That's easier to pass in, > and none of the callers give more precise error messages

[PATCH 4/8] interpret_branch_name: allow callers to restrict expansions

2017-02-28 Thread Jeff King
The original purpose of interpret_branch_name() was to be used by get_sha1() in resolving refs. As such, some of its expansions may point to refs outside of the local "refs/heads" namespace. Over time, the function has been picked up by other callers who want to use the ref-expansion to give the u