]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'jc/archive-list-with-extra-args' into maint-2.43
authorJunio C Hamano <gitster@pobox.com>
Fri, 9 Feb 2024 00:22:04 +0000 (16:22 -0800)
committerJunio C Hamano <gitster@pobox.com>
Fri, 9 Feb 2024 00:22:04 +0000 (16:22 -0800)
"git archive --list extra garbage" silently ignored excess command
line parameters, which has been corrected.

* jc/archive-list-with-extra-args:
  archive: "--list" does not take further options

archive.c
t/t5000-tar-tree.sh

index ca11db185b15a73dd31b239d91a609071faa9a2a..8da820d1ce0d5ab30a8de592008ba5675d8c8935 100644 (file)
--- a/archive.c
+++ b/archive.c
@@ -685,6 +685,8 @@ static int parse_archive_args(int argc, const char **argv,
                base = "";
 
        if (list) {
+               if (argc)
+                       die(_("extra command line parameter '%s'"), *argv);
                for (i = 0; i < nr_archivers; i++)
                        if (!is_remote || archivers[i]->flags & ARCHIVER_REMOTE)
                                printf("%s\n", archivers[i]->name);
index 4b4c3315d885f02fdcf2be65885ea9107f65b86d..72b8d0ff02e34be0606747c850b0815be31196d4 100755 (executable)
@@ -124,6 +124,16 @@ test_expect_success 'setup' '
        EOF
 '
 
+test_expect_success '--list notices extra parameters' '
+       test_must_fail git archive --list blah &&
+       test_must_fail git archive --remote=. --list blah
+'
+
+test_expect_success 'end-of-options is correctly eaten' '
+       git archive --list --end-of-options &&
+       git archive --remote=. --list --end-of-options
+'
+
 test_expect_success 'populate workdir' '
        mkdir a &&
        echo simple textfile >a/a &&