@@ -311,11 +311,12 @@ static const char *parse_cmd_verify(struct ref_transaction *transaction,
311
311
312
312
static const char * parse_cmd_option (struct strbuf * input , const char * next )
313
313
{
314
- if (!strncmp (next , "no-deref" , 8 ) && next [8 ] == line_termination )
314
+ const char * rest ;
315
+ if (skip_prefix (next , "no-deref" , & rest ) && * rest == line_termination )
315
316
update_flags |= REF_NO_DEREF ;
316
317
else
317
318
die ("option unknown: %s" , next );
318
- return next + 8 ;
319
+ return rest ;
319
320
}
320
321
321
322
static void update_refs_stdin (struct ref_transaction * transaction )
@@ -332,16 +333,16 @@ static void update_refs_stdin(struct ref_transaction *transaction)
332
333
die ("empty command in input" );
333
334
else if (isspace (* next ))
334
335
die ("whitespace before command: %s" , next );
335
- else if (starts_with (next , "update " ))
336
- next = parse_cmd_update (transaction , & input , next + 7 );
337
- else if (starts_with (next , "create " ))
338
- next = parse_cmd_create (transaction , & input , next + 7 );
339
- else if (starts_with (next , "delete " ))
340
- next = parse_cmd_delete (transaction , & input , next + 7 );
341
- else if (starts_with (next , "verify " ))
342
- next = parse_cmd_verify (transaction , & input , next + 7 );
343
- else if (starts_with (next , "option " ))
344
- next = parse_cmd_option (& input , next + 7 );
336
+ else if (skip_prefix (next , "update " , & next ))
337
+ next = parse_cmd_update (transaction , & input , next );
338
+ else if (skip_prefix (next , "create " , & next ))
339
+ next = parse_cmd_create (transaction , & input , next );
340
+ else if (skip_prefix (next , "delete " , & next ))
341
+ next = parse_cmd_delete (transaction , & input , next );
342
+ else if (skip_prefix (next , "verify " , & next ))
343
+ next = parse_cmd_verify (transaction , & input , next );
344
+ else if (skip_prefix (next , "option " , & next ))
345
+ next = parse_cmd_option (& input , next );
345
346
else
346
347
die ("unknown command: %s" , next );
347
348
0 commit comments