Skip to contentSkip to conversation

Managing submodules on large multi-user projects

DISCUSSION R. Tyler Ballance 4 participants 7 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

As some of you may recall from my last swath of emails to the list regarding memory usage and repository size, we have quite a large repository. About a month ago, I added a submodule to the primary repo in an effort to start to segment where possible, particularly around third party modules.

I've noticed that keeping submodules updated is an absolute pain, particularly with a large multiuser setup with *lots* of branches.

What will tend to happen is that the submodule reference will be updated in the master branch (we use a centralized model) and then committed (imagine the commit reference was incremented from A-B).

Other developers with other branches will then periodically merge master into their project/topic branches but will either neglect to run git submodule update or our bootstrap script (which also executes the submodule update command). At this point they'll have outstanding changes of their own, and the submodule will be marked as "modified" as well. Usually what will then happen is they'll git commit -a without thinking and the submodule's reference will be changed (typically from B->A, undoing the previous change).

Are there any saner ways of managing this? I've been trying to get the git submodule update command to run with as many hooks as possible (pre-commit, post-update) to make sure that developers aren't inadvertantly breaking things, but nothing seems to ensure that *everybody* is up to date and that *everybody* doesn't inadvertantly commit changes to the submodule?

Feeling trapped in a box of PEBKAC.

Cheers

Signature · 2 lines
-R. Tyler Ballance
Slide, Inc.
#1 lore raw
Quoted 8 lines · R. Tyler Ballance

As some of you may recall from my last swath of emails to the list regarding memory usage and repository size, we have quite a large repository. About a month ago, I added a submodule to the primary repo in an effort to start to segment where possible, particularly around third party modules.

I've noticed that keeping submodules updated is an absolute pain, particularly with a large multiuser setup with *lots* of branches.

Just so I understand, is the reason you're splitting into submodules *just* to avoid memory usage / repository size issues? I can sort of understand the memory usage issues - sort of - but how does it reduce repository size if you need to need to check out all the submodule repositories along with the main project anyway?

Just looking to clarify for myself. (I'm continuing my work on git-subtree, which is getting more and more positive feedback. It solves all the *other* problems that you listed vs. submodules, but it certainly doesn't resolve any repository size issues.)

Have fun,

Avery

#2 lore raw
Quoted 7 lines · Avery Pennarun
Quoted 6 lines · R. Tyler Ballance

As some of you may recall from my last swath of emails to the list regarding memory usage and repository size, we have quite a large repository. About a month ago, I added a submodule to the primary repo in an effort to start to segment where possible, particularly around third party modules.

Quoted 8 lines
Quoted 2 lines

I've noticed that keeping submodules updated is an absolute pain, particularly with a large multiuser setup with *lots* of branches.

Just so I understand, is the reason you're splitting into submodules *just* to avoid memory usage / repository size issues? I can sort of understand the memory usage issues - sort of - but how does it reduce repository size if you need to need to check out all the submodule repositories along with the main project anyway?

I've got an eye on submodules as a way of avoiding the need to require a whole tree clone to just work on parts of it, but that's not really relevant to my query, just explaining our environment and setting the stage ;)

We're using submodules right now similar to how we used svn externals in the past (except better, clearly), to incorporate outside components (like open source projects) that our stack depends on.

Quoted 4 lines

Just looking to clarify for myself. (I'm continuing my work on git-subtree, which is getting more and more positive feedback. It solves all the *other* problems that you listed vs. submodules, but it certainly doesn't resolve any repository size issues.)

Good to know, we're still on Git 1.6.1, are there any benefits or additional features in more recent releases of Git that help alleviate the submodules issues I outlined at the top of the thread?

Cheers

Signature · 2 lines
-R. Tyler Ballance
Slide, Inc.
#3 lore raw
Quoted 7 lines · R. Tyler Ballance
Quoted 5 lines · Avery Pennarun

Just so I understand, is the reason you're splitting into submodules *just* to avoid memory usage / repository size issues?  I can sort of understand the memory usage issues - sort of - but how does it reduce repository size if you need to need to check out all the submodule repositories along with the main project anyway?

Quoted 7 lines

I've got an eye on submodules as a way of avoiding the need to require a whole tree clone to just work on parts of it, but that's not really relevant to my query, just explaining our environment and setting the stage ;)

We're using submodules right now similar to how we used svn externals in the past (except better, clearly), to incorporate outside components (like open source projects) that our stack depends on.

That makes sense.

Quoted 8 lines
Quoted 4 lines

Just looking to clarify for myself.  (I'm continuing my work on git-subtree, which is getting more and more positive feedback.  It solves all the *other* problems that you listed vs. submodules, but it certainly doesn't resolve any repository size issues.)

Good to know, we're still on Git 1.6.1, are there any benefits or additional features in more recent releases of Git that help alleviate the submodules issues I outlined at the top of the thread?

git-subtree is my own little project that hasn't been accepted into git proper yet. It does work with git 1.6.1 (and also git 1.5.4, at least) just by dropping the script into your PATH. Google "git subtree" for more.

AFAIK, the particular issues you outlined with submodules continue to exist in latest git. They are certainly fixable (they aren't *fundamental* problems), but nobody has fixed them yet. I looked at the issues for a long time and failed miserably to find a good general solution, but that's just me.

Have fun,

Avery

#4 lore raw
In reply to R. Tyler Ballance
Quoted 24 lines · R. Tyler Ballance

As some of you may recall from my last swath of emails to the list regarding memory usage and repository size, we have quite a large repository. About a month ago, I added a submodule to the primary repo in an effort to start to segment where possible, particularly around third party modules.

I've noticed that keeping submodules updated is an absolute pain, particularly with a large multiuser setup with *lots* of branches.

What will tend to happen is that the submodule reference will be updated in the master branch (we use a centralized model) and then committed (imagine the commit reference was incremented from A-B).

Other developers with other branches will then periodically merge master into their project/topic branches but will either neglect to run git submodule update or our bootstrap script (which also executes the submodule update command). At this point they'll have outstanding changes of their own, and the submodule will be marked as "modified" as well. Usually what will then happen is they'll git commit -a without thinking and the submodule's reference will be changed (typically from B->A, undoing the previous change).

Quoted 6 lines

Are there any saner ways of managing this? I've been trying to get the git submodule update command to run with as many hooks as possible (pre-commit, post-update) to make sure that developers aren't inadvertantly breaking things, but nothing seems to ensure that *everybody* is up to date and that *everybody* doesn't inadvertantly commit changes to the submodule?

Have you tried repo?
http://source.android.com/download/using-repo

Signature · 1 line
Felipe Contreras
#5 lore raw

Hey Felipe, reply inline..

Quoted 26 lines · Felipe Contreras
Quoted 18 lines · R. Tyler Ballance

I've noticed that keeping submodules updated is an absolute pain, particularly with a large multiuser setup with *lots* of branches.

What will tend to happen is that the submodule reference will be updated in the master branch (we use a centralized model) and then committed (imagine the commit reference was incremented from A-B).

Other developers with other branches will then periodically merge master into their project/topic branches but will either neglect to run git submodule update or our bootstrap script (which also executes the submodule update command). At this point they'll have outstanding changes of their own, and the submodule will be marked as "modified" as well. Usually what will then happen is they'll git commit -a without thinking and the submodule's reference will be changed (typically from B->A, undoing the previous change).

Quoted 6 lines

Are there any saner ways of managing this? I've been trying to get the git submodule update command to run with as many hooks as possible (pre-commit, post-update) to make sure that developers aren't inadvertantly breaking things, but nothing seems to ensure that *everybody* is up to date and that *everybody* doesn't inadvertantly commit changes to the submodule?

Quoted 2 lines

Have you tried repo?
http://source.android.com/download/using-repo

No I've not tried repo, and the likelihood of getting our now 100+ user organization to switch over is highly unlikely.

Since I originally posted to this thread, I've had to entirely *remove* the submodule from the super-project and just dump the code in (boo, hiss) since it just caused too much damn trouble.

I'm going to give a newer version of Git a try and hope that everythin is better now, since the need has arisen for a git submodule again and things will get gnarly if I have to do another source dump.

:(

-R. Tyler Ballance
Slide, Inc.

#6 lore raw
In reply to R. Tyler Ballance

2009/5/29 R. Tyler Ballance <[email protected]>:

Quoted 8 lines

Other developers with other branches will then periodically merge master into their project/topic branches but will either neglect to run git submodule update or our bootstrap script (which also executes the submodule update command). At this point they'll have outstanding changes of their own, and the submodule will be marked as "modified" as well. Usually what will then happen is they'll git commit -a without thinking and the submodule's reference will be changed (typically from B->A, undoing the previous change).

This (the fact that "git commit -a" updates submodules in the index after merge) is probably our bug (or at least an unfinished feature).