git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Make it possible to run git archive --remote without a git directory.

From
Simon Hausmann <simon@lst.de>
Date
Apr 5, 2007, 08:12 UTC
Message-ID
<200704051012.37361.simon@lst.de>

Try a gentle git directory setup for the archive command that remains fatal for the local case but permits operation without a local git repository when using --remote. If in the remote case a git directory is present it will then still be used for proxy settings, but that is optional now.

Signed-off-by: Simon Hausmann <simon@lst.de>
---
 builtin-archive.c |    6 ++++++
 git.c             |    2 +-
 2 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/builtin-archive.c b/builtin-archive.c
index 2fae885..434fec7 100644
--- a/builtin-archive.c
+++ b/builtin-archive.c
@@ -243,11 +243,17 @@ int cmd_archive(int argc, const char **argv, const char 
*prefix)
 	struct archiver ar;
 	int tree_idx;
 	const char *remote = NULL;
+	int nongit = 0;
+
+	prefix = setup_git_directory_gently(&nongit);
 
 	remote = extract_remote_arg(&argc, argv);
 	if (remote)
 		return run_remote_archiver(remote, argc, argv);
 
+	if (nongit)
+		die("Not a git repository");
+
 	setvbuf(stderr, NULL, _IOLBF, BUFSIZ);
 
 	memset(&ar, 0, sizeof(ar));
diff --git a/git.c b/git.c
index 5b1bc2a..33dd4d3 100644
--- a/git.c
+++ b/git.c
@@ -226,7 +226,7 @@ static void handle_internal_command(int argc, const char 
**argv, char **envp)
 		{ "add", cmd_add, RUN_SETUP | NOT_BARE },
 		{ "annotate", cmd_annotate, USE_PAGER },
 		{ "apply", cmd_apply },
-		{ "archive", cmd_archive, RUN_SETUP },
+		{ "archive", cmd_archive },
 		{ "blame", cmd_blame, RUN_SETUP },
 		{ "branch", cmd_branch, RUN_SETUP },
 		{ "bundle", cmd_bundle },
-- 
1.5.1
Next: Simon Hausmann
Message 1 of 3 in “Make it possible to run git archive --remote without a git directory.”
  1. Make it possible to run git archive --remote without a git directory.Simon Hausmann, Apr 5, 2007
  2. Simon HausmannApr 5, 2007
  3. René ScharfeApr 5, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.