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
Tim Harper <timcharper@gmail.com>
Date
Apr 30, 2008, 21:37 UTC
Message-ID
<EFEF26F9-D5D6-4BAC-9A8F-6D96E45AFAF7@gmail.com>
In-Reply-To
<32541b130804301331o70310831raf71db7cbb51d507@mail.gmail.com>
On Apr 30, 2008, at 2:31 PM, Avery Pennarun wrote:
Show 15 quoted lines
> On 4/30/08, Tim Harper <timcharper@gmail.com> wrote:
>>> The problem, of course, is that you can easily have valuable, but
>>> not-tracked, files in there.  Deleting the submodule is therefore no
>>> option.
>>
>> Submodules are not deleted.  They are moved out of the working copy  
>> into a
>> folder in .git.  Therefore, upon changing back to the branch with the
>> submodule, they are restored, without nay a hair on their head lost.
>
> <drool>
>
> Yes!  I'm a little sad that I didn't think of that, because it sounds
> like *exactly* what I want.
>
Glad to hear I'm not the only one who feels that way :)
> What about the following case:
> - submodule matches the super module checkin
?
>
> - make changes to submodule but to *not* commit them

Changes will never be lost, because the submodule is either stashed away, working copy and all, or a "checkout" command is issued to change the HEAD pointer. The latter is like changing branches with uncommitted code - the changes will either be carried, and possibly conflict.

>
> - switch supermodule branches, which should checkout a different  
> submodule

Submodule is automatically changed for you, so changing branches makes sure you always have the "whole project". Recursion isn't handled at the time being, so it only works for 1 level deep.

>
> - submodule checkout causes a conflict with uncommitted files

Oooh - this could be a problem currently, especially if you're not on a branch. If you have to resolve conflicts the way to resolve them is to commit, and you can't switch to a branch to commit unless you resolve your issues. In which case, you'll probably want to resolve, commit, then create a new branch with your current HEAD, then merge it into a branch. I'll visit that as issues arise. This is bleeding edge experimentation here :)

Show 7 quoted lines
>
>
> What will/should happen here?  It seems like either the supermodule's
> submodule pointer won't be set properly (ie. git-submodule-update will
> fail, but the supermodule won't be marked as conflicted, thus
> git-commit in the supermodule will commit the wrong submodule
> revision) or else submodule files might have to be lost or something.

This is a good point: I don't believe that submodules have anyway to mark the submodule revision as "conflicted". In order for this concept to be handled in its full glory, that will most certainly need to be handled.

Show 7 quoted lines
>
>
> Also, someone earlier asked for a link to your work.  I'd like to see
> it too, as I don't know what a "textmate git bundle" is.  I gather
> textmate is a MacOS X program, but I don't know what that has to do
> with git-submodule :)
>
TextMate is an editor for MacOSX.

Here's a link to the bundle. It's written in ruby.: http://github.com/timcharper/git-tmbundle/

What does it have to do with submodules? It's essentially a "GUI" for git. It provides automation for a lot of common tasks also. My team has a need for submodules, but unfortunately in their current state I couldn't recommend it to them, so I "smoothed over" the rough edges by automating a lot of the awkwardness. So far, it's been working well for us.

> Thanks,
>
> Avery
Thank you!
Tim
Previous: Avery PennarunNext: Avery Pennarun
Message 11 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.