diff options
author | Matthew DeVore <matvore@google.com> | 2018-10-23 04:13:42 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-10-23 07:52:57 +0300 |
commit | 669b1d2aaec73ba762bf566078308075886ca208 (patch) | |
tree | 221c7ff149683106450a6ba51e2b613c0bffae27 /revision.c | |
parent | 368a89124c3ad859631452f7b012d0ad939375f3 (diff) |
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 'revision.c')
-rw-r--r-- | revision.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/revision.c b/revision.c index b42c836d7a..748310c2a3 100644 --- a/revision.c +++ b/revision.c @@ -2105,7 +2105,8 @@ 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 (!strcmp(arg, "--exclude-promisor-objects")) { + } else if (revs->allow_exclude_promisor_objects_opt && + !strcmp(arg, "--exclude-promisor-objects")) { if (fetch_if_missing) die("BUG: exclude_promisor_objects can only be used when fetch_if_missing is 0"); revs->exclude_promisor_objects = 1; |