Merge branch 'jc/archive-list-with-extra-args' into maint-2.43

"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
This commit is contained in:
Junio C Hamano 2024-02-08 16:22:04 -08:00
commit 878f8c42dc
2 changed files with 12 additions and 0 deletions

View file

@ -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);

View file

@ -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 &&