On Mon, Nov 19, 2012 at 04:49:09PM -0800, Junio C Hamano wrote: > "W. Trevor King" <wk...@tremily.us> writes: > > >> From what I have heard of projects using this: They usually still have > >> something that records the SHA1s on a regular basis. Thinking further, > >> why not record them in git? We could add an option to update which > >> creates such a commit. > > > > I think it's best to have users craft their own commit messages > > explaining why the branch was updated. That said, an auto-generated > > hint (a la "git merge") would probably be a useful extra feature. > > I am not quite sure I agree. When the project says "Use the tip of > 'bar' branch for the submodule 'foo'" at the top-level, does an > individual user who is not working on the submodule 'foo' but merely > is using it have any clue as to why the submodule's 'foo' branch > 'foo' moved, or does he necessarily even care?
If he doesn't care, why is he updating the submodule gitlink? > Now, since somebody created the top-level commit you have just > pulled and checked out, other people may have worked on submodule > 'foo' [*1*]. What should happen on "git submodule update foo"? If the 'foo' checkout is not the one listed in the superproject's .gitmodules, the update should bail with an appropriate error message, and let the user sort things out. $ git submodule update --pull foo error: Your local changes to the following submodule would be overwritten by update:… This is similar to how Git currently bails on dirty-tree branch switches: $ git checkout my-branch error: Your local changes to the following files would be overwritten by checkout:… Without "--pull", the update command is intended to checkout the hash specified in .gitmodules. If you've committed some local work in foo and then explicitly ask for an update, I suppose you get clobbered. > What should appear in "git diff"? The working tree taken as a whole > is different from what the superproject's commit describes (which is > the state the person who created the superproject wanted to record) > even though this user does not have anything to do with the change > at 'foo' from the recorded commit to the current tip of 'bar'. What > would his description for the reason why the branch was updated? The submodule content is not part of the superproject. All the superproject has is a gitlink. If the gitlink hasn't changed, "git diff" in the superproject shouldn't say anything. I'll probably have time to write up v4 over the weekend. Maybe having a more explicit example will clear things up. -- This email may be signed or encrypted with GnuPG (http://www.gnupg.org). For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy
Description: OpenPGP digital signature