diff options
author | Matthew DeVore <matvore@google.com> | 2018-12-03 14:10:19 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-12-06 14:52:56 +0900 |
commit | bbcde41a70a7e0264c214896aac84d1ec3fdcbf6 (patch) | |
tree | a43a0775df8d2cc095b39ddd9cefd94c4d7c11dc /revision.c | |
parent | exclude-promisor-objects: declare when option is allowed (diff) | |
download | tgif-bbcde41a70a7e0264c214896aac84d1ec3fdcbf6.tar.xz |
revision.c: put promisor option in specialized struct
Put the allow_exclude_promisor_objects flag in setup_revision_opt. When
it was in rev_info, it was unclear when it was used, since rev_info is
passed to functions that don't use the flag. This resulted in
unnecessary setting of the flag in prune.c, so fix that as well.
Signed-off-by: Matthew DeVore <matvore@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'revision.c')
-rw-r--r-- | revision.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/revision.c b/revision.c index 748310c2a3..f19de0de34 100644 --- a/revision.c +++ b/revision.c @@ -1746,7 +1746,8 @@ static void add_message_grep(struct rev_info *revs, const char *pattern) } static int handle_revision_opt(struct rev_info *revs, int argc, const char **argv, - int *unkc, const char **unkv) + int *unkc, const char **unkv, + const struct setup_revision_opt* opt) { const char *arg = argv[0]; const char *optarg; @@ -2105,7 +2106,7 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg revs->limited = 1; } else if (!strcmp(arg, "--ignore-missing")) { revs->ignore_missing = 1; - } else if (revs->allow_exclude_promisor_objects_opt && + } else if (opt && opt->allow_exclude_promisor_objects && !strcmp(arg, "--exclude-promisor-objects")) { if (fetch_if_missing) die("BUG: exclude_promisor_objects can only be used when fetch_if_missing is 0"); @@ -2127,7 +2128,7 @@ void parse_revision_opt(struct rev_info *revs, struct parse_opt_ctx_t *ctx, const char * const usagestr[]) { int n = handle_revision_opt(revs, ctx->argc, ctx->argv, - &ctx->cpidx, ctx->out); + &ctx->cpidx, ctx->out, NULL); if (n <= 0) { error("unknown option `%s'", ctx->argv[0]); usage_with_options(usagestr, options); @@ -2346,7 +2347,8 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s continue; } - opts = handle_revision_opt(revs, argc - i, argv + i, &left, argv); + opts = handle_revision_opt(revs, argc - i, argv + i, + &left, argv, opt); if (opts > 0) { i += opts - 1; continue; |