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

Re: [BUG?] gitlink without .gitmodules no longer fails recursive clone

From
Stefan Beller <sbeller@google.com>
Date
Jun 12, 2017, 05:30 UTC
Message-ID
<CAGZ79kZuwjQ1qYm5wLXXdMurwyAieWuLETV-Cx61ipO=QcsG+Q@mail.gmail.com>
In-Reply-To
<xmqqbmpw4mpo.fsf@gitster.mtv.corp.google.com>
On Fri, Jun 9, 2017 at 7:10 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 16 quoted lines
> Jeff King <peff@peff.net> writes:
>
>> In an ideal world the user do:
>>
>>   git submodule add git://host/repo.git path
>>
>> which adds the gitlink and the .gitmodules entry. But it doesn't seem
>> unreasonable for somebody unfamiliar with submodules to do:
>>
>>   git clone git://host/repo.git path
>>   git add path
>>
>> This does add the entry as a gitlink, but doesn't write any sort of
>> .gitmodules entry.
>
> I actually would think that is a perfectly valid state.
me too.

But on the other hand I do not want to offend non-submodule-gitlink-users too much. So maybe:

  $ git add <gitlink>
  # Adding a raw gitlink to the index,
  # in case you want to use a submodule,
  # use add a .gitmodules file or use 'git submodule add'
Show 7 quoted lines
> In that
> original repository pair (i.e. the superproject with a submodule
> without an entry in .gitmodules), as long as the configuration in
> the submodule repository "path/.git/config" has necessary remote
> definitions, "git push/fetch --recursive" etc., should also be able
> to work without having to consult .gitmodules at the top-level
> superproject, I would think.
but these are the 2nd step, clone fails first.
Show 19 quoted lines
>
>> With the old code, cloning the repository (either by
>> another user, or in our case during a Pages build), a recursive clone or
>> submodule init would complain loudly. But now it's just quietly ignored.
>> Which seems unfortunate.
>
> Of course, if such an original superproject gets pushed to a
> publishing location and then the result is cloned, without an entry
> in .gitmodules, no information "git submodule" can use to work on
> that "path" exists in that clone.  I would say it is OK to leave it
> as-is when going "--recursive" (what you called "inactive because
> it does not even have a .gitmodules entry).
>
> But even in such a clone, once the user who cloned learns where the
> submodule commit that is recorded in the superproject's tree can be
> obtained out-of-band and makes a clone at "path" manually (which
> replicates the state the original repository pair), things that only
> need to look at "path/.git/config" should be able to work (e.g. "git
> fetch --recursive"), I'd say.
But the user would never learn, because
  $ git clone --recurse-submodules ...
does not complain, but put an empty dir instead.
>
>
Previous: Junio C HamanoNext: Jeff King
Message 9 of 23 in “[BUG?] gitlink without .gitmodules no longer fails recursive clone”
  1. Jeff KingJun 6, 2017
  2. Stefan BellerJun 6, 2017
  3. Brandon WilliamsJun 6, 2017
  4. Jeff KingJun 6, 2017
  5. Jeff KingJun 9, 2017
  6. Junio C HamanoJun 10, 2017
  7. Jeff KingJun 10, 2017
  8. Junio C HamanoJun 10, 2017
  9. Stefan BellerJun 12, 2017
  10. Jeff KingJun 13, 2017
  11. 1/2 add: warn when adding an embedded repositoryJeff King, Jun 13, 2017
  12. Stefan BellerJun 13, 2017
  13. Brandon WilliamsJun 13, 2017
  14. Jeff KingJun 14, 2017
  15. 0/2 warn when adding an embedded repositoryJeff King, Jun 14, 2017
  16. 1/2 add: warn when adding an embedded repositoryJeff King, Jun 14, 2017
  17. 2/2 t: move "git add submodule" into test blocksJeff King, Jun 14, 2017
  18. Stefan BellerJun 14, 2017
  19. Jeff KingJun 15, 2017
  20. Junio C HamanoJun 13, 2017
  21. Jeff KingJun 14, 2017
  22. 2/2 t: move "git add submodule" into test blocksJeff King, Jun 13, 2017
  23. Stefan BellerJun 13, 2017

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.