2269
char *end;
2270
2271
mark = parse_mark_ref(*p, &end);
2272
- if (*end != ' ')
2272
+ if (*end++ != ' ')
2273
die("Missing space after mark: %s", command_buf.buf);
2274
*p = end;
2275
return mark;
2304
if (*p == ':') {
2305
oe = find_mark(parse_mark_ref_space(&p));
2306
hashcpy(sha1, oe->idx.sha1);
2307
- } else if (starts_with(p, "inline ")) {
2307
+ } else if (skip_prefix(p, "inline ", &p)) {
2308
inline_data = 1;
2309
oe = NULL; /* not used with inline_data, but makes gcc happy */
2310
- p += strlen("inline"); /* advance to space */
2310
} else {
2311
if (get_sha1_hex(p, sha1))
2312
die("Invalid dataref: %s", command_buf.buf);
2313
oe = find_object(sha1);
2314
p += 40;
2316
- if (*p != ' ')
2315
+ if (*p++ != ' ')
2316
die("Missing space after SHA1: %s", command_buf.buf);
2317
}
2319
- assert(*p == ' ');
2320
- p++; /* skip space */
2318
2319
strbuf_reset(&uq);
2320
if (!unquote_c_style(&uq, p, &endp)) {
2471
if (*p == ':') {
2472
oe = find_mark(parse_mark_ref_space(&p));
2473
hashcpy(sha1, oe->idx.sha1);
2477
- } else if (starts_with(p, "inline ")) {
2474
+ } else if (skip_prefix(p, "inline ", &p)) {
2475
inline_data = 1;
2476
oe = NULL; /* not used with inline_data, but makes gcc happy */
2480
- p += strlen("inline"); /* advance to space */
2477
} else {
2478
if (get_sha1_hex(p, sha1))
2479
die("Invalid dataref: %s", command_buf.buf);
2480
oe = find_object(sha1);
2481
p += 40;
2486
- if (*p != ' ')
2482
+ if (*p++ != ' ')
2483
die("Missing space after SHA1: %s", command_buf.buf);
2484
}
2489
- assert(*p == ' ');
2490
- p++; /* skip space */
2485
2486
/* <commit-ish> */
2487
s = lookup_branch(p);
2997
die("Invalid dataref: %s", command_buf.buf);
2998
e = find_object(sha1);
2999
*p += 40;
3000
+ if (*(*p)++ != ' ')
3001
+ die("Missing space after tree-ish: %s", command_buf.buf);
3002
}
3003
3004
while (!e || e->type != OBJ_TREE)
3050
if (!is_null_sha1(root->versions[1].sha1))
3051
root->versions[1].mode = S_IFDIR;
3052
load_tree(root);
3057
- if (*p++ != ' ')
3058
- die("Missing space after tree-ish: %s", command_buf.buf);
3053
}
3054
if (*p == '"') {
3055
static struct strbuf uq = STRBUF_INIT;