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

[PATCH] Allow curl helper to work without a local repository

From
Daniel Barkalow <barkalow@iabervon.org>
Date
Nov 4, 2009, 02:52 UTC
Message-ID
<alpine.LNX.2.00.0911032149390.14365@iabervon.org>

It's okay to use the curl helper without a local repository, so long as you don't use "fetch". There aren't any git programs that would try to use it, and it doesn't make sense to try it (since there's nowhere to write the results), but we may as well be clear.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
---
This is the simple change to let remote-curl work without a local 
repository for git ls-remote; it leave the transport-helper code assuming 
that all helpers can list without a local repo, which happens to be true 
of this helper, the only one in current git.
 remote-curl.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/remote-curl.c b/remote-curl.c
index 2faf1c6..ebdab36 100644
--- a/remote-curl.c
+++ b/remote-curl.c
@@ -82,9 +82,10 @@ int main(int argc, const char **argv)
 	struct strbuf buf = STRBUF_INIT;
 	const char *url;
 	struct walker *walker = NULL;
+	int nongit;
 
 	git_extract_argv0_path(argv[0]);
-	setup_git_directory();
+	setup_git_directory_gently(&nongit);
 	if (argc < 2) {
 		fprintf(stderr, "Remote needed\n");
 		return 1;
@@ -103,6 +104,8 @@ int main(int argc, const char **argv)
 			break;
 		if (!prefixcmp(buf.buf, "fetch ")) {
 			char *obj = buf.buf + strlen("fetch ");
+			if (nongit)
+				die("Fetch attempted without a local repo");
 			if (!walker)
 				walker = get_http_walker(url, remote);
 			walker->get_all = 1;
-- 
1.6.5.2.142.g063c5.dirty
Next: Sverre Rabbelier
Message 1 of 3 in “Allow curl helper to work without a local repository”
  1. Allow curl helper to work without a local repositoryDaniel Barkalow, Nov 4, 2009
  2. Sverre RabbelierNov 4, 2009
  3. Daniel BarkalowNov 4, 2009

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.