summaryrefslogtreecommitdiff
path: root/t/t1006-cat-file.sh
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2021-12-28 13:28:46 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-12-30 21:05:29 (GMT)
commit485fd2c3dae9c05b43fe237f402274a59eb68e81 (patch)
treed0dcd9cba0c8ae9e4ee649fe05492ed2f577144c /t/t1006-cat-file.sh
parent5a40417876c8ec97e1f367a1638a558ec010e3d8 (diff)
downloadgit-485fd2c3dae9c05b43fe237f402274a59eb68e81.zip
git-485fd2c3dae9c05b43fe237f402274a59eb68e81.tar.gz
git-485fd2c3dae9c05b43fe237f402274a59eb68e81.tar.bz2
cat-file: make --batch-all-objects a CMDMODE
The usage of OPT_CMDMODE() in "cat-file"[1] was added in parallel with the development of[3] the --batch-all-objects option[4], so we've since grown[5] checks that it can't be combined with other command modes, when it should just be made a top-level command-mode instead. It doesn't combine with --filters, --textconv etc. By giving parse_options() information about what options are mutually exclusive with one another we can get the die() message being removed here for free, we didn't even use that removed message in some cases, e.g. for both of: --batch-all-objects --textconv --batch-all-objects --filters We'd take the "goto usage" in the "if (opt)" branch, and never reach the previous message. Now we'll emit e.g.: $ git cat-file --batch-all-objects --filters error: option `filters' is incompatible with --batch-all-objects 1. b48158ac94c (cat-file: make the options mutually exclusive, 2015-05-03) 2. https://lore.kernel.org/git/xmqqtwspgusf.fsf@gitster.dls.corp.google.com/ 3. https://lore.kernel.org/git/20150622104559.GG14475@peff.net/ 4. 6a951937ae1 (cat-file: add --batch-all-objects option, 2015-06-22) 5. 321459439e1 (cat-file: support --textconv/--filters in batch mode, 2016-09-09) Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t1006-cat-file.sh')
-rwxr-xr-xt/t1006-cat-file.sh7
1 files changed, 2 insertions, 5 deletions
diff --git a/t/t1006-cat-file.sh b/t/t1006-cat-file.sh
index fc9191c..ebec206 100755
--- a/t/t1006-cat-file.sh
+++ b/t/t1006-cat-file.sh
@@ -14,7 +14,8 @@ for switches in \
'-p -t' \
'-t -s' \
'-s --textconv' \
- '--textconv --filters'
+ '--textconv --filters' \
+ '--batch-all-objects -e'
do
test_expect_success "usage: cmdmode $switches" '
test_cmdmode_usage git cat-file $switches
@@ -41,10 +42,6 @@ do
test_expect_success "usage: $opt requires another option" '
test_expect_code 129 git cat-file $opt
'
-
- test_expect_failure "usage: incompatible options: --batch-all-objects with $opt" '
- test_incompatible_usage git cat-file --batch-all-objects $opt
- '
done
for opt in $short_modes