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

Re: Git benchmark - comparison with Bazaar, Darcs, Git and Mercurial

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Aug 1, 2007, 17:03 UTC
Message-ID
<alpine.LFD.0.999.0708010937050.3582@woody.linux-foundation.org>
In-Reply-To
<87tzrjfe5h.wl%cworth@cworth.org>
On Wed, 1 Aug 2007, Carl Worth wrote:
Show 8 quoted lines
>
> On Wed, 01 Aug 2007 03:15:25 -0700, Junio C Hamano wrote:
> >
> > Are you suggesting to make -l the default for local, in other
> > words?  I personally do not make local clone often enough that I
> > am not disturbed having to type extra " -l" on the command line.
> 
> Personally, I think it would be a great default.

I suspect it probably *would* make sense to default to "-l". Even if it makes me get goose-bumps. I freely admit that my worries are totally illogical.

We might make it something like: "if you use an url, we don't default to local", so the difference would be that

	git clone file:///directory/to/repo
would work the way it does now, but
	git clone /directory/to/repo

would default to "-l" behaviour. That kind of would make sense (and should be easy to implement: it would be a trivial fixup to "connect.c".

Something like this adds support for "file://". And then git-clone could just do something like

	# if the source is a local directory, default to local
	if [ -d "$src" ]; then
		use_local=yes
	fi
or similar.
		Linus
---
 connect.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/connect.c b/connect.c
index 715cdc0..ae49c5a 100644
--- a/connect.c
+++ b/connect.c
@@ -145,6 +145,8 @@ static enum protocol get_protocol(const char *name)
 		return PROTO_SSH;
 	if (!strcmp(name, "ssh+git"))
 		return PROTO_SSH;
+	if (!strcmp(name, "file"))
+		return PROTO_LOCAL;
 	die("I don't handle protocol '%s'", name);
 }
 
@@ -498,13 +500,13 @@ pid_t git_connect(int fd[2], char *url, const char *prog, int flags)
 		end = host;
 
 	path = strchr(end, c);
-	if (c == ':') {
-		if (path) {
+	if (path) {
+		if (c == ':') {
 			protocol = PROTO_SSH;
 			*path++ = '\0';
-		} else
-			path = host;
-	}
+		}
+	} else
+		path = end;
 
 	if (!path || !*path)
 		die("No path specified. See 'man git-pull' for valid url syntax");
Previous: Carl WorthNext: David Kastrup
Message 11 of 29 in “Git benchmark - comparison with Bazaar, Darcs, Git and Mercurial”
  1. Jakub NarebskiAug 1, 2007
  2. Linus TorvaldsAug 1, 2007
  3. Junio C HamanoAug 1, 2007
  4. David KastrupAug 1, 2007
  5. Theodore TsoAug 1, 2007
  6. Junio C HamanoAug 1, 2007
  7. Alex RiesenAug 1, 2007
  8. Alex RiesenAug 1, 2007
  9. Alex RiesenAug 1, 2007
  10. Carl WorthAug 1, 2007
  11. Linus TorvaldsAug 1, 2007
  12. David KastrupAug 1, 2007
  13. Florian WeimerAug 1, 2007
  14. Junio C HamanoAug 2, 2007
  15. David KastrupAug 2, 2007
  16. Junio C HamanoAug 3, 2007
  17. David KastrupAug 3, 2007
  18. Johan HerlandAug 3, 2007
  19. Theodore TsoAug 1, 2007
  20. Brandon CaseyAug 1, 2007
  21. Allan WindAug 2, 2007
  22. Linus TorvaldsAug 2, 2007
  23. Jakub NarebskiAug 1, 2007
  24. Jakub NarebskiAug 2, 2007
  25. Ramsay JonesAug 2, 2007
  26. Jakub NarebskiAug 1, 2007
  27. Junio C HamanoAug 1, 2007
  28. Jakub NarebskiAug 1, 2007
  29. Shawn O. PearceAug 1, 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.