{"thread":{"id":"28918","subject":"git diff --numstat <branch> always shows dirty submodules","startedAt":"2011-11-12T13:29:36Z","lastAt":"2011-11-13T00:45:25Z","messageCount":3,"participants":["Gelonida N","Jens Lehmann"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"179351","messageId":"j9lsc1$4uf$1@dough.gmane.org","threadId":"28918","inReplyTo":null,"subject":"git diff --numstat <branch> always shows dirty submodules","fromName":"Gelonida N","fromEmail":"gelonida@gmail.com","sentAt":"2011-11-12T13:29:36Z","receivedAt":"2011-11-12T13:29:36Z","isPatch":false,"sender":{"key":"gelonida@gmail.com","avatar":null},"body":"Hi,\n\nI recently started using submodules and they behave mostly as I like to.\n\n\nNormally I use diff --numstat <branch>\nto check quickly whether I am aligned with another branch or not.\n\nThe (for me) annoying feature of submodules is, that they are always\nreported to be different due to files, which are not under git.\n\n\nI type git diff --numstat master\nI get\n1       1       mysubmodule\n\n\nNow I check the differences with git diff master mysubmodule\ndiff --git a/mysubmodule b/mysubmodule\nindex 1382b73..f4f1f1d 160000\n--- a/mysubmodule\n+++ b/mysubmodule\n@@ -1 +1 @@\n-Subproject commit xxxxxxxxx\n+Subproject commit xxxxxxxxx-dirty\n\nSo the only difference (which I wasn't interested in) is, that the\nsubmodule is dirty.\n\n\nIs there any quick way flag / helper script / . . .\nto show differences between two branches without raising the fact, that\nsubmodules are dirty?\n\n>From a user perspective I don't see why this is reported.\nI am not being warned about dirty files in the top level repository\n"},{"id":"179361","messageId":"4EBED0ED.7060005@web.de","threadId":"28918","inReplyTo":"j9lsc1$4uf$1@dough.gmane.org","subject":"Re: git diff --numstat <branch> always shows dirty submodules","fromName":"Jens Lehmann","fromEmail":"jens.lehmann@web.de","sentAt":"2011-11-12T20:02:53Z","receivedAt":"2011-11-12T20:02:53Z","isPatch":false,"sender":{"key":"jens.lehmann@web.de","avatar":"https://avatars.githubusercontent.com/u/135220?v=4"},"body":"Am 12.11.2011 14:29, schrieb Gelonida N:\n> I recently started using submodules and they behave mostly as I like to.\n\nGood to hear that.\n\n> Normally I use diff --numstat<branch>\n> to check quickly whether I am aligned with another branch or not.\n>\n> The (for me) annoying feature of submodules is, that they are always\n> reported to be different due to files, which are not under git.\n>\n>\n> I type git diff --numstat master\n> I get\n> 1       1       mysubmodule\n>\n>\n> Now I check the differences with git diff master mysubmodule\n> diff --git a/mysubmodule b/mysubmodule\n> index 1382b73..f4f1f1d 160000\n> --- a/mysubmodule\n> +++ b/mysubmodule\n> @@ -1 +1 @@\n> -Subproject commit xxxxxxxxx\n> +Subproject commit xxxxxxxxx-dirty\n>\n> So the only difference (which I wasn't interested in) is, that the\n> submodule is dirty.\n >\n> Is there any quick way flag / helper script / . . .\n> to show differences between two branches without raising the fact, that\n> submodules are dirty?\n\nYes, there is the \"--ignore-submodules\" command line option and the\ndiff.ignoreSubmodules (which can be set globally and/or per repo) and\nsubmodule.<name.>ignore configuration settings. They can be set to\n\"untracked\", \"dirty\" or \"all\" to control what you want to see.\n\nDid you check areas in the Documentation where you did expect to find\nthem mentioned but they weren't? Then please say so that we can fix\nthat.\n\n>> From a user perspective I don't see why this is reported.\n> I am not being warned about dirty files in the top level repository\n\nThis is so you can't forget to add new files inside the submodule,\nwhich can lead to breakage when other people clone the superproject\nbut won't get the new files from the submodule because you didn't\ncommit them there.\n"},{"id":"179365","messageId":"j9n3v5$ncj$1@dough.gmane.org","threadId":"28918","inReplyTo":"4EBED0ED.7060005@web.de","subject":"Re: git diff --numstat <branch> always shows dirty submodules","fromName":"Gelonida N","fromEmail":"gelonida@gmail.com","sentAt":"2011-11-13T00:45:25Z","receivedAt":"2011-11-13T00:45:25Z","isPatch":false,"sender":{"key":"gelonida@gmail.com","avatar":null},"body":"Hi Jens,\n\nThanks a lot for your answer.\n\nOn 11/12/2011 09:02 PM, Jens Lehmann wrote:\n> Am 12.11.2011 14:29, schrieb Gelonida N:\n>> I recently started using submodules and they behave mostly as I like to.\n>> Normally I use diff --numstat<branch>\n>> to check quickly whether I am aligned with another branch or not.\n>> . . . \n>> Is there any quick way flag / helper script / . . .\n>> to show differences between two branches without raising the fact, that\n>> submodules are dirty?\n> \n> Yes, there is the \"--ignore-submodules\" command line option and the\n> diff.ignoreSubmodules (which can be set globally and/or per repo) and\n> submodule.<name.>ignore configuration settings. They can be set to\n> \"untracked\", \"dirty\" or \"all\" to control what you want to see.\nI tried this immediately and at works perfectly for git diff.\nPlease see also my comments at the end of this post\n\n> \n> Did you check areas in the Documentation where you did expect to find\n> them mentioned but they weren't? Then please say so that we can fix\n> that.\n> \n\nApologies. My bad. I must have read the output of\ngit help diff\ntoo quickly.\nIt is there plain as the day. :-(\n\n>>> From a user perspective I don't see why this is reported.\n>> I am not being warned about dirty files in the top level repository\n> \n> This is so you can't forget to add new files inside the submodule,\n> which can lead to breakage when other people clone the superproject\n> but won't get the new files from the submodule because you didn't\n> commit them there.\n\nWell I wouldn't expect to find this kind of info (by default) in the\noutput of a git-diff.\n\nIf you git-diff two branches of a project without submodules it doesn't\ntell you either, that you have untracked files in the repository.\n\n\nI would have expected this kind of output just as result of\n'git status'\n(as it is already today)\n#\tmodified:  submodule (untracked content)\n\nGit status reports untracked files in the super project AND in it\nreports, that there are untracked files in the submodule.\nSo this seems to be more consistent to me than the diff case.\n\n\nOn the other hand I would consider it usefult if git status could\noptionally report the complete list of untracked files also for the\nsubmodules\n(So far I didn't search in depth  in doc whether there is a switch\nfor it.)\n\n\nA first shot was reading the output of git help status:\n>       If status.submodulesummary is set to a non zero number or true (identical to -1 or an unlimited number), the\n>        submodule summary will be enabled for the long format and a summary of commits for modified submodules will\n>        be shown (see --summary-limit option of git-submodule(1)).\n\nI put thus following lines in .git/config of my repository\nstatus]\n    submodulesummary = true\n\n\n but the untracked files of my submodule were not reported. (will follow\nthe doc of git-submodule)\n\n\n\nWhat is also confusing to me is, that the setting\ndiff.ignoreSubmodules is also being used by git status.\n\nThere seems to be no variable\nstatus.ignoreSubmodules\n\nSo it seems impossible (without aliases) to\nhave git diff NOT report the untracked files,\nbut git status report them.\n\nI guess I'll go for a solution with git aliases\n"}]}