summaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2021-08-23 14:30:21 +0200
committerJunio C Hamano <gitster@pobox.com>2021-08-31 02:06:18 +0200
commit367c5f36a6a0fa7f8f706b10f9bb2f0e28baaa1a (patch)
tree7e7947182893d7b5256829b25b890f835cc11535 /t
parentcommit-graph: show usage on "commit-graph [write|verify] garbage" (diff)
downloadgit-367c5f36a6a0fa7f8f706b10f9bb2f0e28baaa1a.tar.xz
git-367c5f36a6a0fa7f8f706b10f9bb2f0e28baaa1a.zip
commit-graph: show "unexpected subcommand" error
Bring the "commit-graph" command in line with the error output and general pattern in cmd_multi_pack_index(). Let's test for that output, and also cover the same potential bug as was fixed in the multi-pack-index command in 88617d11f9d (multi-pack-index: fix potential segfault without sub-command, 2021-07-19). Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Reviewed-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t5318-commit-graph.sh16
1 files changed, 15 insertions, 1 deletions
diff --git a/t/t5318-commit-graph.sh b/t/t5318-commit-graph.sh
index 09a2ccd292..295c5bd94d 100755
--- a/t/t5318-commit-graph.sh
+++ b/t/t5318-commit-graph.sh
@@ -6,10 +6,24 @@ test_description='commit graph'
GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS=0
test_expect_success 'usage' '
- test_expect_code 129 git commit-graph write blah &&
+ 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" &&