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

From: "emilylime via GitGitGadget" <[email-masked]>
Date: Sun, 09 Mar 2025 10:12:35 +0000

From: emilylime <[email-masked]>

Signed-off-by: emilylime <[email-masked]>
---
    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"));
+	}
+
 	init_archivers();
 
 	if (output)

base-commit: f93ff170b93a1782659637824b25923245ac9dd1
-- 
gitgitgadget