git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Philip Oakley" <philipoakley@iee.org>
To: "Stefan Beller" <sbeller@google.com>, <jrnieder@gmail.com>
Cc: <git@vger.kernel.org>, <gitster@pobox.com>, <sop@google.com>,
	"Stefan Beller" <sbeller@google.com>
Subject: Re: [PATCH] submodule init: warn about falling back to a local path
Date: Wed, 22 Feb 2017 15:01:50 -0000	[thread overview]
Message-ID: <F50FAF9C5F724A87B5424494262E1BAD@PhilipOakley> (raw)
In-Reply-To: 20170221231815.4123-1-sbeller@google.com

From: "Stefan Beller" <sbeller@google.com>
> When a submodule is initialized, the config variable 
> 'submodule.<name>.url'
> is set depending on the value of the same variable in the .gitmodules
> file. When the URL indicates to be relative, then the url is computed
> relative to its default remote. The default remote cannot be determined
> accurately in all cases, such that it falls back to 'origin'.
>
> The 'origin' remote may not exist, though. In that case we give up looking
> for a suitable remote and we'll just assume it to be a local relative 
> path.
>
> This can be confusing to users as there is a lot of guessing involved,
> which is not obvious to the user.

Would a note in the user docs about the fallback you list above also be 
useful?

>
> So in the corner case of assuming a local autoritative truth, warn the
> user to lessen the confusion.
>
> This behavior was introduced in 4d6893200 (submodule add: allow relative
> repository path even when no url is set, 2011-06-06), which shared the
> code with submodule-init and then ported to C in 3604242f080a (submodule:
> port init from shell to C, 2016-04-15).
>
> In case of submodule-add, this behavior makes sense in some use cases[1],
> however for submodule-init there does not seem to be an immediate obvious
> use case to fall back to a local submodule. However there might be, so
> warn instead of die here.
>
> [1] e.g. 
> http://stackoverflow.com/questions/8721984/git-ignore-files-for-public-repository-but-not-for-private
> "store a secret locally in a submodule, with no intention to publish it"
>
> Reported-by: Shawn Pearce <spearce@spearce.org>
> Signed-off-by: Stefan Beller <sbeller@google.com>
> ---
> builtin/submodule--helper.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
--
Philip 


  reply	other threads:[~2017-02-22 20:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-21 23:18 [PATCH] submodule init: warn about falling back to a local path Stefan Beller
2017-02-22 15:01 ` Philip Oakley [this message]
2017-02-23  0:24   ` Stefan Beller
2017-02-24  0:17     ` Stefan Beller
2017-02-24  8:51       ` Johannes Sixt
2017-02-24 18:22         ` Stefan Beller
2017-02-24 20:19           ` Junio C Hamano
2017-02-24 20:27             ` Stefan Beller
2017-02-25  1:31               ` Stefan Beller

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=F50FAF9C5F724A87B5424494262E1BAD@PhilipOakley \
    --to=philipoakley@iee.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    --cc=sbeller@google.com \
    --cc=sop@google.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).