revisions: refactor handle_revision_opt into parse_revision_opt.
It seems we're using handle_revision_opt the same way each time, have a wrapper around it that does the 9-liner we copy each time instead. handle_revision_opt can be static in the module for now, it's always possible to make it public again if needed. Signed-off-by: Pierre Habouzit <madcoder@debian.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
14ec9cbdae
commit
6b61ec0564
@ -2305,8 +2305,6 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
|
||||
parse_options_start(&ctx, argc, argv, PARSE_OPT_KEEP_DASHDASH |
|
||||
PARSE_OPT_KEEP_ARGV0);
|
||||
for (;;) {
|
||||
int n;
|
||||
|
||||
switch (parse_options_step(&ctx, options, blame_opt_usage)) {
|
||||
case PARSE_OPT_HELP:
|
||||
exit(129);
|
||||
@ -2320,14 +2318,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
|
||||
ctx.argv[0] = "--children";
|
||||
reverse = 1;
|
||||
}
|
||||
n = handle_revision_opt(&revs, ctx.argc, ctx.argv,
|
||||
&ctx.cpidx, ctx.out);
|
||||
if (n <= 0) {
|
||||
error("unknown option `%s'", ctx.argv[0]);
|
||||
usage_with_options(blame_opt_usage, options);
|
||||
}
|
||||
ctx.argv += n;
|
||||
ctx.argc -= n;
|
||||
parse_revision_opt(&revs, &ctx, options, blame_opt_usage);
|
||||
}
|
||||
parse_done:
|
||||
argc = parse_options_end(&ctx);
|
||||
|
Reference in New Issue
Block a user