diff options
author | Junio C Hamano <gitster@pobox.com> | 2024-01-09 01:05:14 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-01-09 01:05:14 +0300 |
commit | 6bf317df4b64309c51d6a327a3111dab491d7656 (patch) | |
tree | 6a20a1448a6e8a39f7378b9b559e63f3d0581377 | |
parent | a26002b62827b89a19b1084bd75d9371d565d03c (diff) | |
parent | d6b6cd139359097f565023f9481c9943989e4463 (diff) |
Merge branch 'jc/archive-list-with-extra-args'
"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
-rw-r--r-- | archive.c | 2 | ||||
-rwxr-xr-x | t/t5000-tar-tree.sh | 10 |
2 files changed, 12 insertions, 0 deletions
@@ -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); diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh index 4b4c3315d8..72b8d0ff02 100755 --- a/t/t5000-tar-tree.sh +++ b/t/t5000-tar-tree.sh @@ -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 && |