Re: [PATCH] fast-import: catch garbage after marks in from/merge
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Apr 1, 2012, 23:12 UTC
- Message-ID
- <20120401231259.GE20883@burratino>
- In-Reply-To
- <20120401225407.GA12127@padd.com>
Hi Pete,
Pete Wyckoff wrote:
Show 6 quoted lines
> from :1M 100644 :103 hello.c > > It is missing a newline and should be: > > from :1 > M 100644 :103 hello.c
Good idea; thanks.
I agree that this at least deserves a warning and probably should error out.
[...]
Show 15 quoted lines
> --- a/fast-import.c
> +++ b/fast-import.c
> @@ -2537,8 +2537,16 @@ static int parse_from(struct branch *b)
> hashcpy(b->branch_tree.versions[0].sha1, t);
> hashcpy(b->branch_tree.versions[1].sha1, t);
> } else if (*from == ':') {
> - uintmax_t idnum = strtoumax(from + 1, NULL, 10);
> - struct object_entry *oe = find_mark(idnum);
> + char *eptr;
> + uintmax_t idnum = strtoumax(from + 1, &eptr, 10);
> + struct object_entry *oe;
> + if (eptr) {
> + for (; *eptr && isspace(*eptr); eptr++) ;
> + if (*eptr)
> + die("Garbage after mark: %s",The implementation seems more complicated than it needs to be. Why allow whitespace after the mark number?
Curious, Jonathan