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

Re: [PATCH/RFC] Documentation: Say that submodule clones use a separate gitdirs.

From
Henri GEIST <geist.henri@laposte.net>
Date
Mar 10, 2014, 18:22 UTC
Message-ID
<1394475733.7891.53.camel@Naugrim>
In-Reply-To
<xmqq61nmrrxe.fsf@gitster.dls.corp.google.com>
Le lundi 10 mars 2014 à 08:31 -0700, Junio C Hamano a écrit :
Show 39 quoted lines
> Andrew Keller <andrew@kellerfarm.com> writes:
> 
> > On Mar 7, 2014, at 7:50 PM, Henri GEIST wrote:
> > ...
> >> To give one of my project to someone else I have copied it on a USB key.
> >> By a simple drag and drop with the mouse.
> >> And I am quite sure I am not alone doing this way.
> >> 
> >> I have done those kind of things lot of time without any problem.
> >> But that day 'the_project' happened to be a submodule cloned by
> >> 'git submodule update' then on the USB key the $GIT_DIR of 'the_project'
> >> was missing.
> >> 
> >> If 'man git-submodule' have made me aware of the particularities of submodules
> >> clone I had write in a terminal:
> >> 
> >> git clone the_project /media/usb/the_project
> >> 
> >> Or at least I had understand what happened quicker.
> >> 
> >> I have nothing against also adding something in repository-layout but I am
> >> pretty sure normal users never read repository-layout as it is not a command
> >> they use. And it is not mentioned in most tutorials.
> >
> > How about something like this:
> >
> > "The git directory of a submodule lives inside the git directory of the parent repository instead of within the working directory."
> >
> > I'm not sure where to put it, though.
> 
> This is not limited to submodules.  There are multiple lower-level
> mechanisms for a $path/.git to borrow the repository data from
> elsewhere outside of $path and a cloned submodule uses only one of
> them.  For any such $path, "cp -R $path $otherplace" will result in
> an "$otherplace" that does not work as a Git repository in exactly
> the same way, whether it happens to be a submodule checkout or not.
> 
> That is why I suggested to enhance description on a more general
> part of the documentation that covers what a Git repository is.

You are entirely right. My view of the situation was biased by the fact that submodule cloning is the only case I am aware of except when the user manually type '--separate-git-dir' where this problem could occur.

If there is some other situation where this can occur as a side effect of a git command it can be good to have the user aware of the list or at least inform them in general case a git repository cannot be copied in a place every body will see. Or place a note in the manpage of every git command which can have this side effect.

Previous: Junio C HamanoNext: Junio C Hamano
Message 10 of 11 in “Documentation: Say that submodule clones use a separate gitdirs.”
  1. Documentation: Say that submodule clones use a separate gitdirs.Henri GEIST, Mar 7, 2014
  2. Andrew KellerMar 7, 2014
  3. Junio C HamanoMar 7, 2014
  4. Henri GEISTMar 7, 2014
  5. Junio C HamanoMar 7, 2014
  6. Henri GEISTMar 8, 2014
  7. Andrew KellerMar 9, 2014
  8. Henri GEISTMar 10, 2014
  9. Junio C HamanoMar 10, 2014
  10. Henri GEISTMar 10, 2014
  11. Junio C HamanoMar 10, 2014

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.