diff options
| author | Justin Tobler <jltobler@gmail.com> | 2025-03-19 13:34:07 -0500 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-03-21 03:40:02 -0700 |
| commit | c9907a19169c186da444e22991df7c9f4237ac40 (patch) | |
| tree | a29d82e779807846f81e5e19f2955fe464c49a8a | |
| parent | rev-list: inline `show_object_with_name()` in `show_object()` (diff) | |
| download | git-c9907a19169c186da444e22991df7c9f4237ac40.tar.gz git-c9907a19169c186da444e22991df7c9f4237ac40.zip | |
rev-list: refactor early option parsing
Before invoking `setup_revisions()`, the `--missing` and
`--exclude-promisor-objects` options are parsed early. In a subsequent
commit, another option is added that must be parsed early.
Refactor the code to parse both options in a single early pass.
Signed-off-by: Justin Tobler <jltobler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
| -rw-r--r-- | builtin/rev-list.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/builtin/rev-list.c b/builtin/rev-list.c index dcd079c16c..04d9c893b5 100644 --- a/builtin/rev-list.c +++ b/builtin/rev-list.c @@ -16,6 +16,7 @@ #include "object-file.h" #include "object-store-ll.h" #include "pack-bitmap.h" +#include "parse-options.h" #include "log-tree.h" #include "graph.h" #include "bisect.h" @@ -639,19 +640,15 @@ int cmd_rev_list(int argc, if (!strcmp(arg, "--exclude-promisor-objects")) { fetch_if_missing = 0; revs.exclude_promisor_objects = 1; - break; - } - } - for (i = 1; i < argc; i++) { - const char *arg = argv[i]; - if (skip_prefix(arg, "--missing=", &arg)) { - if (revs.exclude_promisor_objects) - die(_("options '%s' and '%s' cannot be used together"), "--exclude-promisor-objects", "--missing"); - if (parse_missing_action_value(arg)) - break; + } else if (skip_prefix(arg, "--missing=", &arg)) { + parse_missing_action_value(arg); } } + die_for_incompatible_opt2(revs.exclude_promisor_objects, + "--exclude_promisor_objects", + arg_missing_action, "--missing"); + if (arg_missing_action) revs.do_not_die_on_missing_objects = 1; |
