Re: [PATCH 3/7] revert: Make commit descriptions in insn sheet optional
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Aug 14, 2011, 16:09 UTC
- Message-ID
- <20110814160923.GL18466@elie.gateway.2wire.net>
- In-Reply-To
- <1313310789-10216-4-git-send-email-artagnon@gmail.com>
Ramkumar Ramachandra wrote:
Show 5 quoted lines
> --- 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.