{"thread":{"id":"16402","subject":"git-status for submodules","startedAt":"2008-11-20T03:36:15Z","lastAt":"2008-11-22T00:55:41Z","messageCount":6,"participants":["Chris Frey","Junio C Hamano","Johan Herland"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"96198","messageId":"20081120033615.GA21128@foursquare.net","threadId":"16402","inReplyTo":null,"subject":"git-status for submodules","fromName":"Chris Frey","fromEmail":"cdfrey@foursquare.net","sentAt":"2008-11-20T03:36:15Z","receivedAt":"2008-11-20T03:36:15Z","isPatch":false,"sender":{"key":"cdfrey@foursquare.net","avatar":null},"body":"Hi,\n\nI'm using git 1.6.0.4 and trying to make submodules work for me.  The\ninit/add/update steps are a bit tedious, but workable.  The problem I have\nis when I make a change in a submodule, then git-status does not show\nthe change.\n\nFor example, assuming a directory structure like:  super and super/sub\n\n\tcd super\n\tvi newsuper\n\tvi existing_file\n\tcd sub\n\tvi newsub\n\tcd ..\n\tgit status\n\nThis will show newsuper as needing to be added, and existing_file as changed,\nbut newsub will not appear.\n\nIs there a way to accomplish this?\n\nThanks,\n- Chris\n"},{"id":"96343","messageId":"7vabbtqga8.fsf@gitster.siamese.dyndns.org","threadId":"16402","inReplyTo":"20081120033615.GA21128@foursquare.net","subject":"Re: git-status for submodules","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-11-21T14:56:15Z","receivedAt":"2008-11-21T14:56:15Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Chris Frey <cdfrey@foursquare.net> writes:\n\n> I'm using git 1.6.0.4 and trying to make submodules work for me.  The\n> init/add/update steps are a bit tedious, but workable.  The problem I have\n> is when I make a change in a submodule, then git-status does not show\n> the change.\n\nMy understanding is that this is exactly by design.  The supermodule\ntracks which commit in the subproject is bound to the tree location.\n\nA mere act of changing something in the subproject directory is just a\nsingle, incomplete step to create a new commit in the subproject and will\nnot be seen by the superproject's status.  Instead of this workflow:\n\n> \tcd super\n> \tvi newsuper\n> \tvi existing_file\n> \tcd sub\n> \tvi newsub\n> \tcd ..\n> \tgit status\n\nthe submodule support is geared toward supporting this layout:\n\n\t- \"super\" has a subproject X at \"sub\"\n\n        - When you do a real work on the subproject X, you do so as if\n          there is no supermodule.  IOW, subproject X has to be able to\n          stand on its own.\n\nOne extreme case is you have a(nother) clone of subproject X that is\nindependent from \"super\", do the real work there and create new commit,\nand update the subproject X inside \"super\".  In such a workflow, \"super\"\nwill never see an intermediate state between commits in the subproject\ndirectory.\n\n\n\n\t\n"},{"id":"96346","messageId":"200811211627.10637.johan@herland.net","threadId":"16402","inReplyTo":"7vabbtqga8.fsf@gitster.siamese.dyndns.org","subject":"Re: git-status for submodules","fromName":"Johan Herland","fromEmail":"johan@herland.net","sentAt":"2008-11-21T15:27:10Z","receivedAt":"2008-11-21T15:27:10Z","isPatch":false,"sender":{"key":"johan@herland.net","avatar":"https://avatars.githubusercontent.com/u/547031?v=4"},"body":"On Friday 21 November 2008, Junio C Hamano wrote:\n> Chris Frey <cdfrey@foursquare.net> writes:\n> > I'm using git 1.6.0.4 and trying to make submodules work for me. \n> > The init/add/update steps are a bit tedious, but workable.  The\n> > problem I have is when I make a change in a submodule, then\n> > git-status does not show the change.\n>\n> My understanding is that this is exactly by design.  The supermodule\n> tracks which commit in the subproject is bound to the tree location.\n>\n> A mere act of changing something in the subproject directory is just\n> a single, incomplete step to create a new commit in the subproject\n> and will\n>\n> not be seen by the superproject's status.  Instead of this workflow:\n> > \tcd super\n> > \tvi newsuper\n> > \tvi existing_file\n> > \tcd sub\n> > \tvi newsub\n> > \tcd ..\n> > \tgit status\n>\n> the submodule support is geared toward supporting this layout:\n>\n> \t- \"super\" has a subproject X at \"sub\"\n>\n>         - When you do a real work on the subproject X, you do so as\n> if there is no supermodule.  IOW, subproject X has to be able to\n> stand on its own.\n\nChris' workflow is farily easily supported by running git-status within \neach submodule, like this:\n\ngit submodule foreach \"git status; true\"\n\nIf the above is too cumbersome to type, one can easily wrap an alias \naround it:\n\ngit config alias.substatus 'submodule foreach \"git status; true\"'\ngit substatus\n\n\nHave fun! :)\n\n...Johan\n\n-- \nJohan Herland, <johan@herland.net>\nwww.herland.net\n"},{"id":"96355","messageId":"20081121215608.GA27049@foursquare.net","threadId":"16402","inReplyTo":"200811211627.10637.johan@herland.net","subject":"Re: git-status for submodules","fromName":"Chris Frey","fromEmail":"cdfrey@foursquare.net","sentAt":"2008-11-21T21:56:08Z","receivedAt":"2008-11-21T21:56:08Z","isPatch":false,"sender":{"key":"cdfrey@foursquare.net","avatar":null},"body":"On Fri, Nov 21, 2008 at 04:27:10PM +0100, Johan Herland wrote:\n> Chris' workflow is farily easily supported by running git-status within \n> each submodule, like this:\n> \n> git submodule foreach \"git status; true\"\n> \n> If the above is too cumbersome to type, one can easily wrap an alias \n> around it:\n> \n> git config alias.substatus 'submodule foreach \"git status; true\"'\n> git substatus\n\nFascinating. :-)  This is not yet released, I see, but thanks very much.\n\nLooking at the git sources, submodule foreach doesn't seem to recurse,\nfor the nested submodule case Junio mentioned.  It's still a good start.\n\n- Chris\n"},{"id":"96357","messageId":"20081121224247.GB27049@foursquare.net","threadId":"16402","inReplyTo":"7vabbtqga8.fsf@gitster.siamese.dyndns.org","subject":"Re: git-status for submodules","fromName":"Chris Frey","fromEmail":"cdfrey@foursquare.net","sentAt":"2008-11-21T22:42:47Z","receivedAt":"2008-11-21T22:42:47Z","isPatch":false,"sender":{"key":"cdfrey@foursquare.net","avatar":null},"body":"On Fri, Nov 21, 2008 at 06:56:15AM -0800, Junio C Hamano wrote:\n> My understanding is that this is exactly by design.  The supermodule\n> tracks which commit in the subproject is bound to the tree location.\n\n\n> the submodule support is geared toward supporting this layout:\n> \n> \t- \"super\" has a subproject X at \"sub\"\n> \n>         - When you do a real work on the subproject X, you do so as if\n>           there is no supermodule.  IOW, subproject X has to be able to\n>           stand on its own.\n\nIt's true that subproject X has to be able to stand on its own.  That\nis important from git's perspective as well as for managing subprojects\nin general.\n\nBut I don't see the advantage in hiding submodule information from the\nsupermodule, and if that hiding is by design, I think the design is wrong.\nIn order to manage the various modules effectively (actually, in order to\nmanage any git repo effectively), you need to know what's changed,\nand git-status is the way to do that.  I don't see why submodules should\nbreak that.\n\nWith the new submodule foreach command, though, it should be possible\nto add that as a config option, similar to the way submodule summary\nis handled now.  Maybe I can cook up a patch for that.\n\n- Chris\n"},{"id":"96360","messageId":"7vod08poj6.fsf@gitster.siamese.dyndns.org","threadId":"16402","inReplyTo":"20081121224247.GB27049@foursquare.net","subject":"Re: git-status for submodules","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-11-22T00:55:41Z","receivedAt":"2008-11-22T00:55:41Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Chris Frey <cdfrey@foursquare.net> writes:\n\n> It's true that subproject X has to be able to stand on its own.  That\n> is important from git's perspective as well as for managing subprojects\n> in general.\n>\n> But I don't see the advantage in hiding submodule information from the\n> supermodule, and if that hiding is by design, I think the design is wrong.\n\nThere is no \"wrong\" design in git.  There are ones that do not cover 360\ndegrees of the field, because nobody designed out let alone coded to cover\nsuch use cases.\n\n> In order to manage the various modules effectively (actually, in order to\n> manage any git repo effectively), you need to know what's changed,\n> and git-status is the way to do that.  I don't see why submodules should\n> break that.\n\nChanges to parts of submodules are fundamentally different from changes to\nparts of your main project.  A change to what commit the superproject\nwants for a submodule is at the same level as a change to what content the\nsuperprojects wants for a blob.\n\nIt is not unreasonable to want to have both modes of operation, one that\nshows the uncommitted details in the submodule even when you are viewing\nfrom the superproject (which does not exist), and one that does not (which\ndoes exist, because somebody felt need for it and coded so).\n\nIn order to see the status of your working tree, you may want to take into\naccount what untracked files are in there, but some people do not want to,\nso there is an option to pick which behaviour you want.  We would need a\nsimilar switch.\n\n> With the new submodule foreach command, though, it should be possible\n> to add that as a config option, similar to the way submodule summary\n> is handled now.  Maybe I can cook up a patch for that.\n\nYup, that's the spirit.\n"}]}