git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Stefan Beller <sbeller@google.com>
To: Jens Lehmann <Jens.Lehmann@web.de>
Cc: Junio C Hamano <gitster@pobox.com>,
	Brandon Williams <bmwill@google.com>,
	"git@vger.kernel.org" <git@vger.kernel.org>,
	Jonathan Nieder <jrnieder@gmail.com>
Subject: Re: [PATCH 02/15] submodule: don't use submodule_from_name
Date: Mon, 31 Jul 2017 13:43:04 -0700	[thread overview]
Message-ID: <CAGZ79kZxprtLGOzURHaxc5YzviSj_2Kx23v=gjr2uFb+tbNfjw@mail.gmail.com> (raw)
In-Reply-To: <a3650c9a-fa42-09e6-efcd-f912d5ffc042@web.de>

On Sun, Jul 30, 2017 at 6:43 AM, Jens Lehmann <Jens.Lehmann@web.de> wrote:
> Am 26.07.2017 um 23:06 schrieb Junio C Hamano:
>>
>> Stefan Beller <sbeller@google.com> writes:
>>
>>> Rereading the archives, there was quite some discussion on the design
>>> of these patches, but these lines of code did not get any attention
>>>
>>>      https://public-inbox.org/git/4CDB3063.5010801@web.de/
>>>
>>> I cc'd Jens in the hope of him having a good memory why he
>>> wrote the code that way. :)
>>
>>
>> Thanks for digging.  I wouldn't be surprised if this were a fallback
>> to help a broken entry in .gitmodules that lack .path variable, but
>> we shouldn't be sweeping the problem under the rug like that.
>
>
> Sorry to disappoint you ;-) I added this in 7dce19d374 because
> submodule by path lookup back then only parsed the checked out
> .gitmodules file.

This is still the case AFAICT, as we never ask for a specific .gitmodules
file identified by sha1 of the commit.

> So looking for it by name was a good guess to
> fetch a new submodule that wasn't present in the current HEAD's
> .gitmodules, as the path is used as the default name in "git
> submodule add".

3 things:
a) I think it is not as much a feature ('fallback to still make it work'),
   but rather a bug as when there is no (or wrong) entry in the .gitmodules
   file, reporting it is better than trying something.
b) in the case of moved submodules (2 submodules swapped their path)
   this may be harmful as we'd get a wrong submodule potentially.

c) I wonder if we want to use a different default for submodule names
   as I have seen people get confused by path and name being the same,
   e.g. to move a submodule they would have not just adapted the path,
   but any occurrence of the string that reads like the path.
   (i.e. also change the name, defeating the purpose of name/path
   separation).

   For a new name default, I would wager for some non-legible gibberish
   such as "hash( path/time )", as that sends a clear message to not mess
   with the value of the name.

>
> The refactoring in 851e18c385 could and should have removed that
> because since then we use the .gitmodules path to name mapping
> of the fetched commit.
>
>> I wonder if we should barf loudly if there shouldn't be a submodule
>> at that path, i.e.
>>
>>         if (!submodule)
>>                 die("there is no submodule defined for path '%s'"...);
>>
>> though.
>
>
> Not sure if you want to die() or just issue a warning(), but yes.

Either die() or "warning && return 0" is fine with me.

  parent reply	other threads:[~2017-07-31 20:43 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-25 21:39 [PATCH 00/15] submodule-config cleanup Brandon Williams
2017-07-25 21:39 ` [PATCH 01/15] t7411: check configuration parsing errors Brandon Williams
2017-07-26 20:56   ` Junio C Hamano
2017-07-25 21:39 ` [PATCH 02/15] submodule: don't use submodule_from_name Brandon Williams
2017-07-25 23:17   ` Stefan Beller
2017-07-26 21:06     ` Junio C Hamano
2017-07-30 13:43       ` Jens Lehmann
2017-07-30 21:25         ` Junio C Hamano
2017-07-31 20:43         ` Stefan Beller [this message]
2017-08-11 16:53           ` Heiko Voigt
2017-07-25 21:39 ` [PATCH 03/15] add, reset: ensure submodules can be added or reset Brandon Williams
2017-07-25 23:33   ` Stefan Beller
2017-07-25 23:37     ` Brandon Williams
2017-07-26 21:25     ` Junio C Hamano
2017-07-31 20:50       ` Brandon Williams
2017-07-25 21:39 ` [PATCH 04/15] submodule--helper: don't overlay config in remote_submodule_branch Brandon Williams
2017-07-25 23:35   ` Stefan Beller
2017-07-25 21:39 ` [PATCH 05/15] submodule--helper: don't overlay config in update-clone Brandon Williams
2017-07-25 23:37   ` Stefan Beller
2017-07-25 23:39     ` Brandon Williams
2017-07-25 21:39 ` [PATCH 06/15] fetch: don't overlay config with submodule-config Brandon Williams
2017-07-25 23:44   ` Stefan Beller
2017-07-25 23:48     ` Brandon Williams
2017-07-25 21:39 ` [PATCH 07/15] submodule: don't rely on overlayed config when setting diffopts Brandon Williams
2017-07-25 23:46   ` Stefan Beller
2017-07-25 21:39 ` [PATCH 08/15] unpack-trees: don't rely on overlayed config Brandon Williams
2017-07-25 21:39 ` [PATCH 09/15] submodule: remove submodule_config callback routine Brandon Williams
2017-07-26 21:31   ` Junio C Hamano
2017-07-25 21:39 ` [PATCH 10/15] diff: stop allowing diff to have submodules configured in .git/config Brandon Williams
2017-07-25 21:39 ` [PATCH 11/15] submodule-config: remove support for overlaying repository config Brandon Williams
2017-07-25 21:39 ` [PATCH 12/15] submodule-config: move submodule-config functions to submodule-config.c Brandon Williams
2017-07-25 21:39 ` [PATCH 13/15] submodule-config: lazy-load a repository's .gitmodules file Brandon Williams
2017-07-25 21:39 ` [PATCH 14/15] unpack-trees: improve loading of .gitmodules Brandon Williams
2017-07-25 21:39 ` [PATCH 15/15] submodule: remove gitmodules_config Brandon Williams
2017-08-03 18:19 ` [PATCH v2 00/15] submodule-config cleanup Brandon Williams
2017-08-03 18:19   ` [PATCH v2 01/15] t7411: check configuration parsing errors Brandon Williams
2017-08-03 18:19   ` [PATCH v2 02/15] submodule: don't use submodule_from_name Brandon Williams
2017-08-03 18:57     ` Stefan Beller
2017-08-04 21:53       ` Brandon Williams
2017-08-11 16:59         ` Heiko Voigt
2017-08-03 20:17     ` Junio C Hamano
2017-08-03 18:19   ` [PATCH v2 03/15] add, reset: ensure submodules can be added or reset Brandon Williams
2017-08-03 18:19   ` [PATCH v2 04/15] submodule--helper: don't overlay config in remote_submodule_branch Brandon Williams
2017-08-03 18:19   ` [PATCH v2 05/15] submodule--helper: don't overlay config in update-clone Brandon Williams
2017-08-03 18:19   ` [PATCH v2 06/15] fetch: don't overlay config with submodule-config Brandon Williams
2017-08-03 18:19   ` [PATCH v2 07/15] submodule: don't rely on overlayed config when setting diffopts Brandon Williams
2017-08-03 18:19   ` [PATCH v2 08/15] unpack-trees: don't respect submodule.update Brandon Williams
2017-08-03 20:26     ` Stefan Beller
2017-08-03 20:37     ` Junio C Hamano
2017-08-03 20:43       ` Stefan Beller
2017-08-03 18:19   ` [PATCH v2 09/15] submodule: remove submodule_config callback routine Brandon Williams
2017-08-03 18:19   ` [PATCH v2 10/15] diff: stop allowing diff to have submodules configured in .git/config Brandon Williams
2017-08-03 20:40     ` Junio C Hamano
2017-08-04 21:59       ` Brandon Williams
2017-08-03 18:19   ` [PATCH v2 11/15] submodule-config: remove support for overlaying repository config Brandon Williams
2017-08-03 18:19   ` [PATCH v2 12/15] submodule-config: move submodule-config functions to submodule-config.c Brandon Williams
2017-08-03 18:19   ` [PATCH v2 13/15] submodule-config: lazy-load a repository's .gitmodules file Brandon Williams
2017-08-03 18:19   ` [PATCH v2 14/15] unpack-trees: improve loading of .gitmodules Brandon Williams
2017-08-11 17:18     ` Heiko Voigt
2017-08-03 18:20   ` [PATCH v2 15/15] submodule: remove gitmodules_config Brandon Williams
2017-08-03 20:09   ` [PATCH v2 00/15] submodule-config cleanup 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

  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='CAGZ79kZxprtLGOzURHaxc5YzviSj_2Kx23v=gjr2uFb+tbNfjw@mail.gmail.com' \
    --to=sbeller@google.com \
    --cc=Jens.Lehmann@web.de \
    --cc=bmwill@google.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.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).