Re: [PATCH v2] branch -D: allow - as abbreviation of '@{-1}'

2016-03-24 Thread elena petrashen
On Tue, Mar 22, 2016 at 8:07 PM, Junio C Hamano wrote: > Elena Petrashen writes: > >> +static int expand_dash_shortcut(const char **argv, int dash_position) >> +{ >> + if (!strcmp(argv[dash_position], "-")){ >> + argv[dash_position] =

Re: [PATCH v2] branch -D: allow - as abbreviation of '@{-1}'

2016-03-22 Thread Eric Sunshine
On Tue, Mar 22, 2016 at 1:12 PM, Junio C Hamano wrote: > Junio C Hamano writes: >> I _think_ strbuf_branchname() leaves "@{-}" when you do not have >> enough branch switches in the reflog, so perhaps ... > > This is a tangent, but the value returned from

Re: [PATCH v2] branch -D: allow - as abbreviation of '@{-1}'

2016-03-22 Thread Junio C Hamano
Junio C Hamano writes: > I _think_ strbuf_branchname() leaves "@{-}" when you do not have > enough branch switches in the reflog, so perhaps ... This is a tangent, but the value returned from strbuf_branchname() is not well documented, and nobody looks at it. It might not be

Re: [PATCH v2] branch -D: allow - as abbreviation of '@{-1}'

2016-03-22 Thread Junio C Hamano
Elena Petrashen writes: > +static int expand_dash_shortcut(const char **argv, int dash_position) > +{ > + if (!strcmp(argv[dash_position], "-")){ > + argv[dash_position] = "@{-1}"; > + return 1; > + } > + return 0; > +} > int

Re: [PATCH v2] branch -D: allow - as abbreviation of '@{-1}'

2016-03-22 Thread Matthieu Moy
Hi, and thanks for the quick reroll. A small advice: don't hesitate to reply to reviewers in the thread for v1. As a reviewer, I appreciate a quick reply like "OK, will do in v2", or even "I disagree, I think my version is better because: ..." (I'm not _always_ right ;-) ). Elena Petrashen

[PATCH v2] branch -D: allow - as abbreviation of '@{-1}'

2016-03-22 Thread Elena Petrashen
Signed-off-by: Elena Petrashen --- This micro-patch is meant to allow “-“ as a short-hand for “@{-1} for branch -D (Cf. $gmane/230828): * based on the discussion on the previous version of the patch, added the advice on how to restore the deleted branch using git