summaryrefslogtreecommitdiff
path: root/t/t5318-commit-graph.sh
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2021-09-10 11:46:25 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-09-10 11:46:25 -0700
commit1396a95ee0a1d4853139e896114020409c506e52 (patch)
tree25b33d164d51a3c5d09b6353a2160cb4196400e9 /t/t5318-commit-graph.sh
parentMerge branch 'mh/send-email-reset-in-reply-to' (diff)
parentcommit-graph: show "unexpected subcommand" error (diff)
downloadtgif-1396a95ee0a1d4853139e896114020409c506e52.tar.xz
Merge branch 'ab/commit-graph-usage'
Fixes on usage message from "git commit-graph". * ab/commit-graph-usage: commit-graph: show "unexpected subcommand" error commit-graph: show usage on "commit-graph [write|verify] garbage" commit-graph: early exit to "usage" on !argc multi-pack-index: refactor "goto usage" pattern commit-graph: use parse_options_concat() commit-graph: remove redundant handling of -h commit-graph: define common usage with a macro
Diffstat (limited to 't/t5318-commit-graph.sh')
-rwxr-xr-xt/t5318-commit-graph.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/t/t5318-commit-graph.sh b/t/t5318-commit-graph.sh
index af88f805aa..295c5bd94d 100755
--- a/t/t5318-commit-graph.sh
+++ b/t/t5318-commit-graph.sh
@@ -5,6 +5,25 @@ test_description='commit graph'
GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS=0
+test_expect_success 'usage' '
+ test_expect_code 129 git commit-graph write blah 2>err &&
+ test_expect_code 129 git commit-graph write verify
+'
+
+test_expect_success 'usage shown without sub-command' '
+ test_expect_code 129 git commit-graph 2>err &&
+ ! grep error: err
+'
+
+test_expect_success 'usage shown with an error on unknown sub-command' '
+ cat >expect <<-\EOF &&
+ error: unrecognized subcommand: unknown
+ EOF
+ test_expect_code 129 git commit-graph unknown 2>stderr &&
+ grep error stderr >actual &&
+ test_cmp expect actual
+'
+
test_expect_success 'setup full repo' '
mkdir full &&
cd "$TRASH_DIRECTORY/full" &&