Re: [PATCH] Add new @ shortcut for HEAD

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 30, 2013 at 6:00 PM, Felipe Contreras
<felipe.contreras@xxxxxxxxx> 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;
}

-- 
Felipe Contreras
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]