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

Re: Making submodules easier to work with (auto-update on checkout or merge, stash & restore submodules)

From
RSRoman Shaposhnik <rvs@sun.com>
Date
Apr 30, 2008, 19:55 UTC
Message-ID
<1209585345.25663.797.camel@work.sfbay.sun.com>
In-Reply-To
<32541b130804300947s6083156etc6514cc13c24af13@mail.gmail.com>
On Wed, 2008-04-30 at 12:47 -0400, Avery Pennarun wrote:
Show 6 quoted lines
> On 4/30/08, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> That said, it makes submodule folders act completely inconsistently
> with normal folders, which is highly undesirable.  The current
> behaviour strongly encourages me to avoid submodules when I would
> otherwise like to use them, just to keep the rest of my team members
> (who are not git experts) from going insane.

Well said. I find myself in exactly the same situation wrt. submodules. To give an analogy imagine that everytime you had a mount-point in your path you'd have to do something special in order to cross it. IOW, open("/tmp/foo/bar/baz.c") would just work, where open("/mnt/point1/foo.c") would require you to first cross /mnt/point1 somehow. Currently submodules feel very much like the second case to me. Now, I've shut up for the time being on that other thread, since I'd like to come up with a clearly defined workflow first. But for the record: the way submodules are implemented right now in a porcelain make them pretty much an impossible sell to those in my org who don't want to know much about SCMs.

Show 8 quoted lines
> >  But once you did "submodule init", you will never need to run it again,
> >  since it edits your .git/config, which does not change when switching
> >  branches.
> 
> Not true.  If ".gitmodules" is different between branches, then
> .git/config will have the wrong information.  I think this was the
> reason for the "read .gitmodules directly and don't worry about
> .git/config" discussion/patches earlier.
Exactly!
Show 8 quoted lines
> >  And as for "submodule update", I like the fact that the submodule is not
> >  updated automatically.  For example, when I actively develop a submodule,
> >  but have to rebase the superproject, I would _hate_ it if the submodule
> >  wass updated.
> 
> Why?  Every other folder in your entire project gets updated when you
> "git checkout".  Why are submodules different?  I can personally vouch
> that this is confusing for almost everyone I've seen who tried it.
+1 ;-)
Show 17 quoted lines
> >  > PITFALLS:
> >  > pitfall)
> >  > If you commit a change on a submodule that's not on a branch, auto-updating
> >  > submodules will make it difficult to revive that change.
> >  >
> >  > workaround)
> >  > Don't allow the user to commit unless they are on a branch.
> >  >
> >  > ... couldn't think of anymore.  Anyone?
> 
> We had some discussion on the list earlier about having submodule
> checkouts automatically acquire a branch name, so that commits don't
> get lost as easily.  I was going to think about this more and
> eventually submit a patch, but I haven't gotten to it yet.  Anyway,
> the idea is that you have a branch by default, so that you don't end
> up in the useless situation of not being on a branch, which encourages
> checking in without being on a branch, in the first place.
Can you give a gmane pointer to that thread?

Thanks, Roman.

Previous: Ping YinNext: Avery Pennarun
Message 7 of 22 in “Making submodules easier to work with (auto-update on checkout or merge, stash & restore submodules)”
  1. Tim HarperApr 30, 2008
  2. Tim HarperApr 30, 2008
  3. Andreas EricssonApr 30, 2008
  4. Johannes SchindelinApr 30, 2008
  5. Avery PennarunApr 30, 2008
  6. Ping YinApr 30, 2008
  7. Roman ShaposhnikApr 30, 2008
  8. Avery PennarunApr 30, 2008
  9. Tim HarperApr 30, 2008
  10. Avery PennarunApr 30, 2008
  11. Tim HarperApr 30, 2008
  12. Avery PennarunApr 30, 2008
  13. Roman ShaposhnikApr 30, 2008
  14. Avery PennarunApr 30, 2008
  15. Finn Arne GangstadMay 1, 2008
  16. Avery PennarunMay 1, 2008
  17. Roman ShaposhnikMay 6, 2008
  18. Avery PennarunMay 7, 2008
  19. Ping YinMay 8, 2008
  20. Steven GrimmMay 1, 2008
  21. Roman ShaposhnikMay 6, 2008
  22. Ping YinMay 1, 2008

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.