From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: "René Scharfe" <l.s.r@web.de>, git@vger.kernel.org
Subject: Re: [RFC/PATCH] archive: "--list" does not take further options
Date: Thu, 21 Dec 2023 10:13:58 -0800 [thread overview]
Message-ID: <xmqqmsu3mnix.fsf@gitster.g> (raw)
In-Reply-To: <20231221085948.GD545870@coredump.intra.peff.net> (Jeff King's message of "Thu, 21 Dec 2023 03:59:48 -0500")
Jeff King <peff@peff.net> writes:
> On Thu, Dec 21, 2023 at 08:30:36AM +0100, René Scharfe wrote:
>> ...
>> Don't we have one? It would affect other unsupported options as well,
>> and this seems to work just fine, e.g.:
>> ...
> Right. The whole idea of upload-archive is to spawn a separate writer
> process and mux the conversation (including errors) back over the wire.
Thanks, both. Just to tie the loose end, let me queue this and
merge it to 'next'.
----- >8 --------- >8 --------- >8 -----
Subject: [PATCH] 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>
---
archive.c | 2 ++
t/t5000-tar-tree.sh | 10 ++++++++++
2 files changed, 12 insertions(+)
diff --git a/archive.c b/archive.c
index ca11db185b..8da820d1ce 100644
--- 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);
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 &&
--
2.43.0-174-g055bb6e996
next prev parent reply other threads:[~2023-12-21 18:14 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-20 23:19 [PATCH/RFC] sparse-checkout: take care of "--end-of-options" in set/add Junio C Hamano
2023-12-20 23:55 ` Josh Steadmon
2023-12-21 2:46 ` Junio C Hamano
2023-12-21 8:40 ` Jeff King
2023-12-21 17:02 ` Junio C Hamano
2023-12-21 21:45 ` Jeff King
2023-12-21 22:04 ` Junio C Hamano
2023-12-23 10:02 ` Jeff King
2023-12-23 15:38 ` rsbecker
2023-12-23 22:45 ` Elijah Newren
2023-12-24 1:02 ` Elijah Newren
2023-12-21 2:41 ` [RFC/PATCH] archive: "--list" does not take further options Junio C Hamano
2023-12-21 7:30 ` René Scharfe
2023-12-21 8:59 ` Jeff King
2023-12-21 18:13 ` Junio C Hamano [this message]
2023-12-21 21:35 ` Jeff King
2023-12-21 8:58 ` Jeff King
2023-12-21 8:36 ` [PATCH/RFC] sparse-checkout: take care of "--end-of-options" in set/add Jeff King
2023-12-21 18:20 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqmsu3mnix.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=l.s.r@web.de \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).