Thread (1 message) 1 message, 1 author, 2025-03-10

Re: [PATCH] archive: error instead of triggering a segfault in `git archive --remote=""`

From: Junio C Hamano <hidden>
Date: 2025-03-10 11:25:34

"emilylime via GitGitGadget" [off-list ref] writes:
From: emilylime <redacted>
Here is a place to explain what the change is about, how to
reproduce and observe the symptom, why the current code behaves the
undesirable way, etc. and then propose how to fix it.
Signed-off-by: emilylime <redacted>
Documentation/SubmittingPatches:[[real-name]]?
quoted hunk
---
    Error instead of triggering a segfault in git archive --remote=""

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1877%2Femilyyyylime%2Ffix-archive-remote-segfault-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1877/emilyyyylime/fix-archive-remote-segfault-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1877

 builtin/archive.c | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/builtin/archive.c b/builtin/archive.c
index 13ea7308c8b..b6fdbfc7dca 100644
--- a/builtin/archive.c
+++ b/builtin/archive.c
@@ -97,6 +97,10 @@ int cmd_archive(int argc,
 	argc = parse_options(argc, argv, prefix, local_opts, NULL,
 			     PARSE_OPT_KEEP_ALL);
 
+	if (remote && !remote[0]) {
+		usage(N_("Option 'remote' may not be left empty"));
+	}
Style--useless {braces} around a single-statement block.

Style--downcase "O" in "Option".

N_() merely marks the string for translation, but yields the string
as-is to the calling function (i.e. usage()).  You probably meant to
use _() instead.  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help