1
0
mirror of https://github.com/git/git synced 2024-06-30 22:54:27 +00:00

archive: "--list" does not take further options

"git archive --list blah" should notice an extra command line
parameter that goes unused.  Make it so.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Junio C Hamano 2023-12-21 10:13:58 -08:00
parent 564d0252ca
commit d6b6cd1393
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 &&