Re: [PATCHv2 03/10] refs.c: Refactor code for mapping between shorthand names and full refnames

2013-05-15 Thread Michael Haggerty
On 05/14/2013 04:24 PM, Johan Herland wrote: On Mon, May 13, 2013 at 10:34 PM, Junio C Hamano gits...@pobox.com wrote: Junio C Hamano gits...@pobox.com writes: Johan Herland jo...@herland.net writes: Obviously, I named it '%1' since it expands into the _first_ component of the

Re: [PATCHv2 03/10] refs.c: Refactor code for mapping between shorthand names and full refnames

2013-05-15 Thread Johan Herland
On Wed, May 15, 2013 at 8:45 AM, Michael Haggerty mhag...@alum.mit.edu wrote: On 05/14/2013 04:24 PM, Johan Herland wrote: I am not sure why we would want refs/remotes/%1/%2 instead of refs/remote/%*. Maybe I've been staring at this for too long, but I find the latter shorter and more

Re: [PATCHv2 03/10] refs.c: Refactor code for mapping between shorthand names and full refnames

2013-05-15 Thread Johan Herland
On Wed, May 15, 2013 at 9:39 AM, Johan Herland jo...@herland.net wrote: On Wed, May 15, 2013 at 8:45 AM, Michael Haggerty mhag...@alum.mit.edu wrote: refs/remotes/%1/%2 (or refs/remotes/%1/%*) might be a nice way to imply that the rule should only be attempted if the input has at least two

Re: [PATCHv2 03/10] refs.c: Refactor code for mapping between shorthand names and full refnames

2013-05-15 Thread Junio C Hamano
Johan Herland jo...@herland.net writes: On Wed, May 15, 2013 at 9:39 AM, Johan Herland jo...@herland.net wrote: On Wed, May 15, 2013 at 8:45 AM, Michael Haggerty mhag...@alum.mit.edu wrote: refs/remotes/%1/%2 (or refs/remotes/%1/%*) might be a nice way to imply that the rule should only be

Re: [PATCHv2 03/10] refs.c: Refactor code for mapping between shorthand names and full refnames

2013-05-15 Thread Eric Wong
Johan Herland jo...@herland.net wrote: Unfortunately, using refs/remotes/%1/%* instead of refs/remotes/%* breaks a number of git-svn tests which puts refs directly within refs/remotes/, and then does things like git reset --hard trunk (expecting trunk - refs/remotes/trunk, which the

Re: [PATCHv2 03/10] refs.c: Refactor code for mapping between shorthand names and full refnames

2013-05-14 Thread Johan Herland
On Mon, May 13, 2013 at 10:34 PM, Junio C Hamano gits...@pobox.com wrote: Junio C Hamano gits...@pobox.com writes: Johan Herland jo...@herland.net writes: Obviously, I named it '%1' since it expands into the _first_ component of the (slash-separated) shorthand. OK, I can buy something like

Re: [PATCHv2 03/10] refs.c: Refactor code for mapping between shorthand names and full refnames

2013-05-14 Thread Junio C Hamano
Johan Herland jo...@herland.net writes: I think I like refs/peers/%1/heads/%* better than refs/peers/%1/heads/%2, since the latter sort of makes me wonder whether the 3rd, 4th, etc. components would be discarded. Makes sense. I am not sure why we would want refs/remotes/%1/%2 instead of

Re: [PATCHv2 03/10] refs.c: Refactor code for mapping between shorthand names and full refnames

2013-05-13 Thread Johan Herland
On Mon, May 13, 2013 at 6:56 AM, Junio C Hamano gits...@pobox.com wrote: Johan Herland jo...@herland.net writes: The refname_expand() function no longer uses mkpath()/mksnpath() to perform the pattern expansion. Instead, it uses strbuf_expand(), which removes the need for using fixed-length

Re: [PATCHv2 03/10] refs.c: Refactor code for mapping between shorthand names and full refnames

2013-05-13 Thread Junio C Hamano
Junio C Hamano gits...@pobox.com writes: Johan Herland jo...@herland.net writes: Obviously, I named it '%1' since it expands into the _first_ component of the (slash-separated) shorthand. OK, I can buy something like %* refs/%* refs/heads/%* ...

Re: [PATCHv2 03/10] refs.c: Refactor code for mapping between shorthand names and full refnames

2013-05-12 Thread Junio C Hamano
Johan Herland jo...@herland.net writes: The refname_expand() function no longer uses mkpath()/mksnpath() to perform the pattern expansion. Instead, it uses strbuf_expand(), which removes the need for using fixed-length buffers from the code. It is a brilliant idea to use strbuf_expand() for