Re: [PATCH] Add new @ shortcut for HEAD
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:57:05
Felipe Contreras [off-list ref] writes:
On Tue, Apr 30, 2013 at 6:00 PM, Felipe Contreras [off-list ref] wrote:quoted
+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).