diff options
author | Matthew DeVore <matvore@google.com> | 2018-10-23 03:13:42 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-10-23 06:52:57 +0200 |
commit | 669b1d2aaec73ba762bf566078308075886ca208 (patch) | |
tree | 221c7ff149683106450a6ba51e2b613c0bffae27 /builtin | |
parent | Documentation/git-log.txt: do not show --exclude-promisor-objects (diff) | |
download | git-669b1d2aaec73ba762bf566078308075886ca208.tar.xz git-669b1d2aaec73ba762bf566078308075886ca208.zip |
exclude-promisor-objects: declare when option is allowed
The --exclude-promisor-objects option causes some funny behavior in at
least two commands: log and blame. It causes a BUG crash:
$ git log --exclude-promisor-objects
BUG: revision.c:2143: exclude_promisor_objects can only be used
when fetch_if_missing is 0
Aborted
[134]
Fix this such that the option is treated like any other unknown option.
The commands that must support it are limited, so declare in those
commands that the flag is supported. In particular:
pack-objects
prune
rev-list
The commands were found by searching for logic which parses
--exclude-promisor-objects outside of revision.c. Extra logic outside of
revision.c is needed because fetch_if_missing must be turned on before
revision.c sees the option or it will BUG-crash. The above list is
supported by the fact that no other command is introspectively invoked
by another command passing --exclude-promisor-object.
Signed-off-by: Matthew DeVore <matvore@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/pack-objects.c | 1 | ||||
-rw-r--r-- | builtin/prune.c | 1 | ||||
-rw-r--r-- | builtin/rev-list.c | 1 |
3 files changed, 3 insertions, 0 deletions
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index e9d3cfb9e3..8ac8ca1d26 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -2853,6 +2853,7 @@ static void get_object_list(int ac, const char **av) init_revisions(&revs, NULL); save_commit_buffer = 0; + revs.allow_exclude_promisor_objects_opt = 1; setup_revisions(ac, av, &revs, NULL); /* make sure shallows are read */ diff --git a/builtin/prune.c b/builtin/prune.c index 4394d01c93..a5c784749e 100644 --- a/builtin/prune.c +++ b/builtin/prune.c @@ -118,6 +118,7 @@ int cmd_prune(int argc, const char **argv, const char *prefix) save_commit_buffer = 0; check_replace_refs = 0; ref_paranoia = 1; + revs.allow_exclude_promisor_objects_opt = 1; init_revisions(&revs, prefix); argc = parse_options(argc, argv, prefix, options, prune_usage, 0); diff --git a/builtin/rev-list.c b/builtin/rev-list.c index 6f5b9b0847..c8f3ac8d09 100644 --- a/builtin/rev-list.c +++ b/builtin/rev-list.c @@ -370,6 +370,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix) git_config(git_default_config, NULL); init_revisions(&revs, prefix); revs.abbrev = DEFAULT_ABBREV; + revs.allow_exclude_promisor_objects_opt = 1; revs.commit_format = CMIT_FMT_UNSPECIFIED; /* |