Re: [PATCH 3/7] revert: Make commit descriptions in insn sheet optional

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

 



Ramkumar Ramachandra wrote:

> --- a/builtin/revert.c
> +++ b/builtin/revert.c
> @@ -697,26 +697,23 @@ static struct commit *parse_insn_line(char *start, struct replay_opts *opts)
>  	unsigned char commit_sha1[20];
>  	char sha1_abbrev[40];
[...]
> +	q = p + strcspn(p, " \n");
> +	if (q - p + 1 > sizeof(sha1_abbrev))
>  		return NULL;

If I understand correctly, the current code makes it perfectly possible
to use commands like

	pick origin/master^^2~5

when that is more convenient to type.  So I wonder whether 40 is actually
a good limit.  Another possibility would be to do something like

	static struct strbuf cmit = STRBUF_INIT;

	strbuf_reset(&cmit);
	...
	strbuf_add(&cmit, p, q - p);

to avoid having to worry about the buffer size altogether.
--
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]