git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Emeric Fermas <emeric.fermas@gmail.com>
Subject: Re: [PATCH 0/3] clone --local fixes
Date: Mon, 28 May 2012 01:36:03 -0400	[thread overview]
Message-ID: <20120528053602.GA11174@sigill.intra.peff.net> (raw)
In-Reply-To: <7vsjemp20j.fsf@alter.siamese.dyndns.org>

On Sat, May 26, 2012 at 11:32:44PM -0700, Junio C Hamano wrote:

> So your example "file:///" should *not* work even if --local is given,
> unless you happen to have a directory called "file:" in your current
> directory and it has path/to/repo subdirectory, which is a git repository.
> Specifically, the repository at /path/to/repo is not what the command line
> is naming.

I think it depends on the definition of "--local". If it means "when we
are cloning without a URL, turn on the local optimizations", then yes,
"file://" should not work. If it means "turn on local optimizations if
this destination supports it", then it should.

The current behavior is ambiguous as to whether it is the first case, or
whether it is the second, and it was simply buggy. The history you gave
argues that the original intent was the former. But to me that is much
less important than what is useful and least surprising to users.

There are basically three sane behaviors for "git clone --local
file://":

  1. --local is silently ignored, because it means "if we are local,
     turn on optimizations" (though it has a horrible name, in that case)

  2. it's an error; you should not use --local with a URL

  3. it should use local optimizations (because file:// is local)

Is there a compelling reason not to do (3)? It seems to be the
friendliest and least surprising to me.

I'll admit I don't care too much about this use case. People don't
tend to type "file://..." when they could type the simpler thing, so I
doubt anyone is hurting. I just don't see a reason not to make it work,
besides the usual "it is a non-zero amount of code".

> I think we probably should stop advertising --local in the documentation
> and help text.

I kind of agree, and that was what I was going to do originally (instead
of making it work). But I do think that "--no-local" (from my patch 3)
is actually useful in practice, so I'd rather not drop the option from
the documentation entirely.

-Peff

  reply	other threads:[~2012-05-28  5:43 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-26  3:42 [PATCH 0/3] clone --local fixes Jeff King
2012-05-26  3:42 ` [PATCH 1/3] t5701: modernize style Jeff King
2012-05-26  3:45 ` [PATCH 2/3] clone: make --local handle URLs Jeff King
2012-05-28 18:31   ` Johannes Sixt
2012-05-28 19:10     ` Jeff King
2012-05-26  3:45 ` [PATCH 3/3] clone: allow --no-local to turn off local optimizations Jeff King
2012-05-26  4:11 ` [PATCH 4/3] clone: send diagnostic messages to stderr Jeff King
2012-05-27  6:32 ` [PATCH 0/3] clone --local fixes Junio C Hamano
2012-05-28  5:36   ` Jeff King [this message]
2012-05-29 17:43     ` Junio C Hamano
2012-05-30 11:03       ` Jeff King
2012-05-30 11:08         ` Jeff King
2012-05-30 11:09         ` [PATCH 1/2] docs/clone: mention that --local may be ignored Jeff King
2012-05-30 11:10         ` [PATCH 2/2] clone: allow --no-local to turn off local optimizations Jeff King
2012-05-30 17:20           ` Junio C Hamano
2012-05-30 21:59             ` Jeff King
2012-05-30 22:10               ` Junio C Hamano
2012-05-30 23:21                 ` Jeff King
2012-05-30 23:33                   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120528053602.GA11174@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=emeric.fermas@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).