From 669b1d2aaec73ba762bf566078308075886ca208 Mon Sep 17 00:00:00 2001 From: Matthew DeVore Date: Mon, 22 Oct 2018 18:13:42 -0700 Subject: 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 Signed-off-by: Junio C Hamano --- t/t4202-log.sh | 4 ++++ t/t8002-blame.sh | 4 ++++ 2 files changed, 8 insertions(+) (limited to 't') diff --git a/t/t4202-log.sh b/t/t4202-log.sh index 25b1f8cc73..61610ce08e 100755 --- a/t/t4202-log.sh +++ b/t/t4202-log.sh @@ -1668,4 +1668,8 @@ test_expect_success 'log --source paints symmetric ranges' ' test_cmp expect actual ' +test_expect_success '--exclude-promisor-objects does not BUG-crash' ' + test_must_fail git log --exclude-promisor-objects source-a +' + test_done diff --git a/t/t8002-blame.sh b/t/t8002-blame.sh index 380e1c1054..eea048e52c 100755 --- a/t/t8002-blame.sh +++ b/t/t8002-blame.sh @@ -118,4 +118,8 @@ test_expect_success '--no-abbrev works like --abbrev=40' ' check_abbrev 40 --no-abbrev ' +test_expect_success '--exclude-promisor-objects does not BUG-crash' ' + test_must_fail git blame --exclude-promisor-objects one +' + test_done -- cgit v1.2.3