git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Allow curl helper to work without a local repository
@ 2009-11-04  2:52 Daniel Barkalow
  2009-11-04  5:32 ` Sverre Rabbelier
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Barkalow @ 2009-11-04  2:52 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Allow curl helper to work without a local repository
  2009-11-04  2:52 [PATCH] Allow curl helper to work without a local repository Daniel Barkalow
@ 2009-11-04  5:32 ` Sverre Rabbelier
  2009-11-04  7:21   ` Daniel Barkalow
  0 siblings, 1 reply; 3+ messages in thread
From: Sverre Rabbelier @ 2009-11-04  5:32 UTC (permalink / raw)
  To: Daniel Barkalow; +Cc: Junio C Hamano, git

Heya,

On Wed, Nov 4, 2009 at 03:52, Daniel Barkalow <barkalow@iabervon.org> wrote:
> 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.

Add a capability for it? :P

-- 
Cheers,

Sverre Rabbelier

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Allow curl helper to work without a local repository
  2009-11-04  5:32 ` Sverre Rabbelier
@ 2009-11-04  7:21   ` Daniel Barkalow
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Barkalow @ 2009-11-04  7:21 UTC (permalink / raw)
  To: Sverre Rabbelier; +Cc: Junio C Hamano, git

On Wed, 4 Nov 2009, Sverre Rabbelier wrote:

> Heya,
> 
> On Wed, Nov 4, 2009 at 03:52, Daniel Barkalow <barkalow@iabervon.org> wrote:
> > 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.
> 
> Add a capability for it? :P

That's the longer-term patch, yes. But doing anything meaningful with that 
requires communicating down to transport-helper that we're not in a local 
repo, which shades into reworking the whole setup/environment code. That's 
why I went with the easy patch for now, since it does fix the bug.

	-Daniel
*This .sig left intentionally blank*

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-11-04  7:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-04  2:52 [PATCH] Allow curl helper to work without a local repository Daniel Barkalow
2009-11-04  5:32 ` Sverre Rabbelier
2009-11-04  7:21   ` Daniel Barkalow

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).