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");