Re: [PATCH] Add new @ shortcut for HEAD
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 30, 2013, 23:24 UTC
- Message-ID
- <7vy5bz8uw7.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <CAMP44s3QT5z1iWsm0cvQDfmZBp_kWbXatQKGaj8H3kzgdK=QFw@mail.gmail.com>
Felipe Contreras <felipe.contreras@gmail.com> writes:
Show 33 quoted lines
> On Tue, Apr 30, 2013 at 6:00 PM, Felipe Contreras
> <felipe.contreras@gmail.com> wrote:
>
>> +static int interpret_empty_at(const char *name, int namelen, int len,
>> struct strbuf *buf)
>> +{
>> + if (namelen - len < 1 || name[len + 1] == '{')
>> + return -1;
>> +
>> + strbuf_reset(buf);
>> + if (len == 0) {
>> + strbuf_add(buf, "HEAD", 4);
>> + return 1;
>> + } else {
>> + strbuf_add(buf, name, len);
>> + return len + 1;
>> + }
>> +}
>
> Hmm, it's not correct, and besides, if we don't parse 'master@', it's
> much simpler:
>
> /* parse @something syntax, when 'something' is not {.*} */
> static int interpret_empty_at(const char *name, int namelen, int len,
> struct strbuf *buf)
> {
> if (len || (namelen > 1 && name[1] == '{'))
> return -1;
>
> strbuf_reset(buf);
> strbuf_add(buf, "HEAD", 4);
> return 1;
> }I'm done with today's integration cycle and pushed the series without these updates out on 'pu'. Hopefully you will have a "drop the last N and replace them with this" update after finishing these experiments by tomorrow? ;-)
Thanks.
People who wanted to see some form of typesaver for HEAD, please poke at the implementation and see if there are cases where @ should be interpreted as HEAD replacement but isn't (or vice-versa).