]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t3301-notes.sh: check that default operation mode doesn't take arguments
authorSZEDER Gábor <szeder.dev@gmail.com>
Fri, 19 Aug 2022 16:03:53 +0000 (18:03 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 19 Aug 2022 18:13:13 +0000 (11:13 -0700)
'git notes' without a subcommand defaults to listing all notes and
doesn't accept any arguments.

We are about to teach parse-options to handle subcommands, and update
'git notes' to make use of that new feature.  So let's add a test to
make sure that the upcoming changes don't inadvertenly change the
behavior in this corner case.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t3301-notes.sh

index d742be8840276a52ef5887659d5405e1f9b08404..3288aaec7dc9362dc923b963e31ccd05005ba351 100755 (executable)
@@ -505,6 +505,11 @@ test_expect_success 'list notes with "git notes"' '
        test_cmp expect actual
 '
 
+test_expect_success '"git notes" without subcommand does not take arguments' '
+       test_expect_code 129 git notes HEAD^^ 2>err &&
+       grep "^error: unknown subcommand" err
+'
+
 test_expect_success 'list specific note with "git notes list <object>"' '
        git rev-parse refs/notes/commits:$commit_3 >expect &&
        git notes list HEAD^^ >actual &&