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

Re: [PATCH 1/2] clone: Fix error message for reference repository

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 8, 2013, 15:30 UTC
Message-ID
<7vip3xyr8c.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20130408145749.GJ27178@pug.qqx.org>
Aaron Schrab <aaron@schrab.com> writes:
Show 11 quoted lines
> At 06:58 -0700 08 Apr 2013, Junio C Hamano <gitster@pobox.com> wrote:
>>I do agree that it would be nice to dereference .git gitfile when we
>>deal with --reference argument, but you do not want to use in-tree
>>repository of a submodule working tree.  What happens when you have
>>to check out a version of the containing superproject that did not
>>have the submodule you are borrowing from?  The directory will
>>disappear, leaving the borrowing repository still pointing at it
>>with its .git/objects/info/alternates file, no?
>
> No, submodule directories don't get removed when you checkout a
> version which didn't contain that submodule.  
In the old world order, we did not use .git gitfile.

The version of the superproject had a submodule at dirA/ and dirA/.git used to be a real directory. "clone --reference /path/to/super/dirA/.git" can borrow objects from there, and will write /path/to/super/dirA/.git/objects (which is a real object store) to the resulting repository's objects/info/alternates.

You switch to a version of the superproject with a plain file at dirA/ or there is nothing at dirA. The checkout will fail and you need to manually rectify the situation [*1*], but after that is done, you do not have any repository at /path/to/super/dirA/.git anymore.

That was the reason why I recommended against the practice.
In the new world order, we use dirA/.git gitfile.

"clone --reference /path/to/super/dirA/.git" does not anticipate .git could be a gitfile, but it can be fixed to dereference it and point at "/path/to/super/.git/modules/moduleA", which will stay there across branch switching at the supermodule level.

"clone" has to store /path/to/super/.git/modules/moduleA in $GIT_DIR/objects/info/alternates of the new repository by dereferencing the value given to --reference. By doing so, what is in the working tree of the superproject would not matter at the time of access in the new repository.

So you are right that we do not remove in the new world order, but then --reference can be given to point at the real location ;-)

[Footnote]

*1* ... for which fundamental fix was made to use dirA/.git gitfile in the submodule working tree in the new world order.

Previous: Aaron SchrabNext: Aaron Schrab
Message 24 of 28 in “clone: Fix error message for reference repository”
  1. 1/2 clone: Fix error message for reference repositoryAaron Schrab, Apr 7, 2013
  2. 2/2 clone: Allow repo using gitfile as a referenceAaron Schrab, Apr 7, 2013
  3. Jonathan NiederApr 7, 2013
  4. Aaron SchrabApr 8, 2013
  5. Junio C HamanoApr 8, 2013
  6. Aaron SchrabApr 8, 2013
  7. 0/2 Using gitfile repository with clone --referenceAaron Schrab, Apr 8, 2013
  8. 1/2 clone: Fix error message for reference repositoryAaron Schrab, Apr 8, 2013
  9. Jonathan NiederApr 9, 2013
  10. 2/2 clone: Allow repo using gitfile as a referenceAaron Schrab, Apr 8, 2013
  11. Jonathan NiederApr 9, 2013
  12. Aaron SchrabApr 9, 2013
  13. Junio C HamanoApr 9, 2013
  14. Aaron SchrabApr 9, 2013
  15. 0/2 Using gitfile repository with clone --referenceAaron Schrab, Apr 9, 2013
  16. 1/2 clone: Fix error message for reference repositoryAaron Schrab, Apr 9, 2013
  17. 2/2 clone: Allow repo using gitfile as a referenceAaron Schrab, Apr 9, 2013
  18. Junio C HamanoApr 9, 2013
  19. Jonathan NiederApr 7, 2013
  20. Aaron SchrabApr 8, 2013
  21. Aaron SchrabApr 8, 2013
  22. Junio C HamanoApr 8, 2013
  23. Aaron SchrabApr 8, 2013
  24. Junio C HamanoApr 8, 2013
  25. Aaron SchrabApr 8, 2013
  26. Junio C HamanoApr 8, 2013
  27. Aaron SchrabApr 8, 2013
  28. Junio C HamanoApr 8, 2013

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.