{"thread":{"id":"25979","subject":"[PATCH] completion: Add PS1 configuration for submodules","startedAt":"2010-12-06T23:22:43Z","lastAt":"2010-12-21T22:56:22Z","messageCount":15,"participants":["Scott Kyle","SZEDER Gábor","Ævar Arnfjörð Bjarmason","Kevin Ballard","Jens Lehmann","Jonathan Nieder"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"157469","messageId":"1291677763-55385-1-git-send-email-scott@appden.com","threadId":"25979","inReplyTo":null,"subject":"[PATCH] completion: Add PS1 configuration for submodules","fromName":"Scott Kyle","fromEmail":"scott@appden.com","sentAt":"2010-12-06T23:22:43Z","receivedAt":"2010-12-06T23:22:43Z","isPatch":true,"sender":{"key":"scott@appden.com","avatar":"https://gravatar.com/avatar/ebac99c82f8cdb7cd1bf934ed569cc0748a700e9e505a4c4decd1af9c9f57291?d=mp&s=160"},"body":"For those who often work on repositories with submodules, the dirty\nindicator for unstaged changes will almost always show because development\nis simultaneously happening on those submodules. The config option\ndiff.ignoreSubmodules is not appropriate for this use because it has larger\nimplications.\n\nSigned-off-by: Scott Kyle <scott@appden.com>\n---\n contrib/completion/git-completion.bash |    7 +++++--\n 1 files changed, 5 insertions(+), 2 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 604fa79..539bcb1 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -37,7 +37,9 @@\n #       value, unstaged (*) and staged (+) changes will be shown next\n #       to the branch name.  You can configure this per-repository\n #       with the bash.showDirtyState variable, which defaults to true\n-#       once GIT_PS1_SHOWDIRTYSTATE is enabled.\n+#       once GIT_PS1_SHOWDIRTYSTATE is enabled.  You can also set\n+#       GIT_PS1_IGNORESUBMODULES to a value that git diff understands\n+#       to adjust the behavior of the dirty state indicator.\n #\n #       You can also see if currently something is stashed, by setting\n #       GIT_PS1_SHOWSTASHSTATE to a nonempty value. If something is stashed,\n@@ -286,7 +288,8 @@ __git_ps1 ()\n \t\telif [ \"true\" = \"$(git rev-parse --is-inside-work-tree 2>/dev/null)\" ]; then\n \t\t\tif [ -n \"${GIT_PS1_SHOWDIRTYSTATE-}\" ]; then\n \t\t\t\tif [ \"$(git config --bool bash.showDirtyState)\" != \"false\" ]; then\n-\t\t\t\t\tgit diff --no-ext-diff --quiet --exit-code || w=\"*\"\n+\t\t\t\t\tlocal ignore_submodules=${GIT_PS1_IGNORESUBMODULES+\"--ignore-submodules=$GIT_PS1_IGNORESUBMODULES\"}\n+\t\t\t\t\tgit diff $ignore_submodules --no-ext-diff --quiet --exit-code || w=\"*\"\n \t\t\t\t\tif git rev-parse --quiet --verify HEAD >/dev/null; then\n \t\t\t\t\t\tgit diff-index --cached --quiet HEAD -- || i=\"+\"\n \t\t\t\t\telse\n-- \n1.7.3.3.574.g98527\n"},{"id":"157481","messageId":"20101207094057.GA6176@neumann","threadId":"25979","inReplyTo":"1291677763-55385-1-git-send-email-scott@appden.com","subject":"Re: [PATCH] completion: Add PS1 configuration for submodules","fromName":"SZEDER Gábor","fromEmail":"szeder@ira.uka.de","sentAt":"2010-12-07T09:40:57Z","receivedAt":"2010-12-07T09:40:57Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"Hi Scott,\n\n\nOn Mon, Dec 06, 2010 at 03:22:43PM -0800, Scott Kyle wrote:\n> For those who often work on repositories with submodules, the dirty\n> indicator for unstaged changes will almost always show because development\n> is simultaneously happening on those submodules. The config option\n> diff.ignoreSubmodules is not appropriate for this use because it has larger\n> implications.\n> \n> Signed-off-by: Scott Kyle <scott@appden.com>\n> ---\n>  contrib/completion/git-completion.bash |    7 +++++--\n>  1 files changed, 5 insertions(+), 2 deletions(-)\n> \n> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\n> index 604fa79..539bcb1 100755\n> --- a/contrib/completion/git-completion.bash\n> +++ b/contrib/completion/git-completion.bash\n> @@ -37,7 +37,9 @@\n>  #       value, unstaged (*) and staged (+) changes will be shown next\n>  #       to the branch name.  You can configure this per-repository\n>  #       with the bash.showDirtyState variable, which defaults to true\n> -#       once GIT_PS1_SHOWDIRTYSTATE is enabled.\n> +#       once GIT_PS1_SHOWDIRTYSTATE is enabled.  You can also set\n> +#       GIT_PS1_IGNORESUBMODULES to a value that git diff understands\n> +#       to adjust the behavior of the dirty state indicator.\n\ngit diff \"understands\" a lot of things, therefore I'd like to be a bit\nmore specific here by mentioning the --ignore-submodules= option:\n\n+#       once GIT_PS1_SHOWDIRTYSTATE is enabled.  You can also set\n+#       GIT_PS1_IGNORESUBMODULES to a value that git diff\n+#       --ignore-submodules= understands to adjust the behavior of the\n+#       dirty state indicator.\n\nBut it might be just me being unfamiliar with submodules.  Otherwise\nit looks good and reasonable to me.\n\n>  #\n>  #       You can also see if currently something is stashed, by setting\n>  #       GIT_PS1_SHOWSTASHSTATE to a nonempty value. If something is stashed,\n> @@ -286,7 +288,8 @@ __git_ps1 ()\n>  \t\telif [ \"true\" = \"$(git rev-parse --is-inside-work-tree 2>/dev/null)\" ]; then\n>  \t\t\tif [ -n \"${GIT_PS1_SHOWDIRTYSTATE-}\" ]; then\n>  \t\t\t\tif [ \"$(git config --bool bash.showDirtyState)\" != \"false\" ]; then\n> -\t\t\t\t\tgit diff --no-ext-diff --quiet --exit-code || w=\"*\"\n> +\t\t\t\t\tlocal ignore_submodules=${GIT_PS1_IGNORESUBMODULES+\"--ignore-submodules=$GIT_PS1_IGNORESUBMODULES\"}\n> +\t\t\t\t\tgit diff $ignore_submodules --no-ext-diff --quiet --exit-code || w=\"*\"\n>  \t\t\t\t\tif git rev-parse --quiet --verify HEAD >/dev/null; then\n>  \t\t\t\t\t\tgit diff-index --cached --quiet HEAD -- || i=\"+\"\n>  \t\t\t\t\telse\n> -- \n> 1.7.3.3.574.g98527\n> \n> \n"},{"id":"157484","messageId":"AANLkTin8JstkjEWaCGZuqpEXZnLMyudFm24K7Y3iCgX6@mail.gmail.com","threadId":"25979","inReplyTo":"1291677763-55385-1-git-send-email-scott@appden.com","subject":"Re: [PATCH] completion: Add PS1 configuration for submodules","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-12-07T12:15:35Z","receivedAt":"2010-12-07T12:15:35Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Tue, Dec 7, 2010 at 00:22, Scott Kyle <scott@appden.com> wrote:\n> For those who often work on repositories with submodules, the dirty\n> indicator for unstaged changes will almost always show because development\n> is simultaneously happening on those submodules. The config option\n> diff.ignoreSubmodules is not appropriate for this use because it has larger\n> implications.\n\nWouldn't it be a lot better to instead add support for showing\nsubmodule dirtyness as distinct from the main tree's dirtyness? Then\nyou could easily spot if you had either your tree / submodule tree\nchanges, without just ignoring them.\n"},{"id":"157534","messageId":"0E479F18-B26A-4216-A71E-C65EAB41A74A@sb.org","threadId":"25979","inReplyTo":"AANLkTin8JstkjEWaCGZuqpEXZnLMyudFm24K7Y3iCgX6@mail.gmail.com","subject":"Re: [PATCH] completion: Add PS1 configuration for submodules","fromName":"Kevin Ballard","fromEmail":"kevin@sb.org","sentAt":"2010-12-07T20:31:40Z","receivedAt":"2010-12-07T20:31:40Z","isPatch":true,"sender":{"key":"kevin@sb.org","avatar":"https://avatars.githubusercontent.com/u/714?v=4"},"body":"On Dec 7, 2010, at 4:15 AM, Ævar Arnfjörð Bjarmason wrote:\n\n> On Tue, Dec 7, 2010 at 00:22, Scott Kyle <scott@appden.com> wrote:\n>> For those who often work on repositories with submodules, the dirty\n>> indicator for unstaged changes will almost always show because development\n>> is simultaneously happening on those submodules. The config option\n>> diff.ignoreSubmodules is not appropriate for this use because it has larger\n>> implications.\n> \n> Wouldn't it be a lot better to instead add support for showing\n> submodule dirtyness as distinct from the main tree's dirtyness? Then\n> you could easily spot if you had either your tree / submodule tree\n> changes, without just ignoring them.\n\nThat sounds like a good idea, but it doesn't necessarily have to come with\nthis patch. Scott's use case here is he has a submodule that is _always_ dirty,\nand he simply doesn't want to see that stuff in the PS1. Having an option to\nshow it separately would be very useful for me, but should perhaps be written\nas a separate patch.\n\n-Kevin Ballard"},{"id":"157533","messageId":"AANLkTinuD2ze_mn5QMLqFaoftwZvTsz-DKv1ojAizg7P@mail.gmail.com","threadId":"25979","inReplyTo":"AANLkTin8JstkjEWaCGZuqpEXZnLMyudFm24K7Y3iCgX6@mail.gmail.com","subject":"Re: [PATCH] completion: Add PS1 configuration for submodules","fromName":"Scott Kyle","fromEmail":"scott@appden.com","sentAt":"2010-12-07T20:37:00Z","receivedAt":"2010-12-07T20:37:00Z","isPatch":true,"sender":{"key":"scott@appden.com","avatar":"https://gravatar.com/avatar/ebac99c82f8cdb7cd1bf934ed569cc0748a700e9e505a4c4decd1af9c9f57291?d=mp&s=160"},"body":"[sorry for the duplicate email, my original was rejected from the list]\n\nOn Tue, Dec 7, 2010 at 4:15 AM, Ævar Arnfjörð Bjarmason\n<avarab@gmail.com> wrote:\n>\n> On Tue, Dec 7, 2010 at 00:22, Scott Kyle <scott@appden.com> wrote:\n> > For those who often work on repositories with submodules, the dirty\n> > indicator for unstaged changes will almost always show because development\n> > is simultaneously happening on those submodules. The config option\n> > diff.ignoreSubmodules is not appropriate for this use because it has larger\n> > implications.\n>\n> Wouldn't it be a lot better to instead add support for showing\n> submodule dirtyness as distinct from the main tree's dirtyness? Then\n> you could easily spot if you had either your tree / submodule tree\n> changes, without just ignoring them.\n\nI considered that, but thought it to be a rather disruptive change,\nand one that conceptually didn't work.  The way I see it, either\nsomebody thinks of their repo as dirty when the submodules are dirty,\nor not. And I think since this behavior has perpetuated for so long,\nmost users are content with how it currently works.  I, however, was\nnot, and so that is why I added an option for people like me.\n\nScott Kyle\n\nhttp://appden.com\nhttp://github.com/appden\nhttp://twitter.com/appden\n"},{"id":"157536","messageId":"4F33DA75-D095-415D-99F8-5236D6F93EE1@sb.org","threadId":"25979","inReplyTo":"AANLkTinuD2ze_mn5QMLqFaoftwZvTsz-DKv1ojAizg7P@mail.gmail.com","subject":"Re: [PATCH] completion: Add PS1 configuration for submodules","fromName":"Kevin Ballard","fromEmail":"kevin@sb.org","sentAt":"2010-12-07T20:41:43Z","receivedAt":"2010-12-07T20:41:43Z","isPatch":true,"sender":{"key":"kevin@sb.org","avatar":"https://avatars.githubusercontent.com/u/714?v=4"},"body":"On Dec 7, 2010, at 12:37 PM, Scott Kyle wrote:\n\n> On Tue, Dec 7, 2010 at 4:15 AM, Ævar Arnfjörð Bjarmason\n> <avarab@gmail.com> wrote:\n>> \n>> On Tue, Dec 7, 2010 at 00:22, Scott Kyle <scott@appden.com> wrote:\n>>> For those who often work on repositories with submodules, the dirty\n>>> indicator for unstaged changes will almost always show because development\n>>> is simultaneously happening on those submodules. The config option\n>>> diff.ignoreSubmodules is not appropriate for this use because it has larger\n>>> implications.\n>> \n>> Wouldn't it be a lot better to instead add support for showing\n>> submodule dirtyness as distinct from the main tree's dirtyness? Then\n>> you could easily spot if you had either your tree / submodule tree\n>> changes, without just ignoring them.\n> \n> I considered that, but thought it to be a rather disruptive change,\n> and one that conceptually didn't work.  The way I see it, either\n> somebody thinks of their repo as dirty when the submodules are dirty,\n> or not. And I think since this behavior has perpetuated for so long,\n> most users are content with how it currently works.  I, however, was\n> not, and so that is why I added an option for people like me.\n\nThe big win for such a change, from my perspective, is it tells me if I need\nto do a `git submodule update --recursive`, or if I actually have dirty changes.\nBecause of that, if nobody else picks this up, I'll probably write a patch\nto introduce such a config at some point in the future. But as I said before,\nthat's something that can be done later and doesn't need to affect this patch.\n\n-Kevin Ballard"},{"id":"157541","messageId":"4CFEA249.907@web.de","threadId":"25979","inReplyTo":"0E479F18-B26A-4216-A71E-C65EAB41A74A@sb.org","subject":"Re: [PATCH] completion: Add PS1 configuration for submodules","fromName":"Jens Lehmann","fromEmail":"jens.lehmann@web.de","sentAt":"2010-12-07T21:08:25Z","receivedAt":"2010-12-07T21:08:25Z","isPatch":true,"sender":{"key":"jens.lehmann@web.de","avatar":"https://avatars.githubusercontent.com/u/135220?v=4"},"body":"Am 07.12.2010 21:31, schrieb Kevin Ballard:\n> On Dec 7, 2010, at 4:15 AM, Ævar Arnfjörð Bjarmason wrote:\n> \n>> On Tue, Dec 7, 2010 at 00:22, Scott Kyle <scott@appden.com> wrote:\n>>> For those who often work on repositories with submodules, the dirty\n>>> indicator for unstaged changes will almost always show because development\n>>> is simultaneously happening on those submodules. The config option\n>>> diff.ignoreSubmodules is not appropriate for this use because it has larger\n>>> implications.\n>>\n>> Wouldn't it be a lot better to instead add support for showing\n>> submodule dirtyness as distinct from the main tree's dirtyness? Then\n>> you could easily spot if you had either your tree / submodule tree\n>> changes, without just ignoring them.\n> \n> That sounds like a good idea, but it doesn't necessarily have to come with\n> this patch. Scott's use case here is he has a submodule that is _always_ dirty,\n> and he simply doesn't want to see that stuff in the PS1. Having an option to\n> show it separately would be very useful for me, but should perhaps be written\n> as a separate patch.\n\nI'm not sure if I understand your case correctly, but if there is only one\nsubmodule that is always dirty and everybody knows that but nobody cares,\nwon't it make sense to change the \"submodule.<name>.ignore\" config option\nfor that peculiar submodule via .git/config or .gitmodules?\n"},{"id":"157544","messageId":"AANLkTinnH4pFaEf=e4YE64f7cwLRx2R_2o_-=JGua30b@mail.gmail.com","threadId":"25979","inReplyTo":"4CFEA249.907@web.de","subject":"Re: [PATCH] completion: Add PS1 configuration for submodules","fromName":"Scott Kyle","fromEmail":"scott@appden.com","sentAt":"2010-12-07T21:17:06Z","receivedAt":"2010-12-07T21:17:06Z","isPatch":true,"sender":{"key":"scott@appden.com","avatar":"https://gravatar.com/avatar/ebac99c82f8cdb7cd1bf934ed569cc0748a700e9e505a4c4decd1af9c9f57291?d=mp&s=160"},"body":"On Tue, Dec 7, 2010 at 1:08 PM, Jens Lehmann <Jens.Lehmann@web.de> wrote:\n> Am 07.12.2010 21:31, schrieb Kevin Ballard:\n>> On Dec 7, 2010, at 4:15 AM, Ęvar Arnfjörš Bjarmason wrote:\n>>\n>>> On Tue, Dec 7, 2010 at 00:22, Scott Kyle <scott@appden.com> wrote:\n>>>> For those who often work on repositories with submodules, the dirty\n>>>> indicator for unstaged changes will almost always show because development\n>>>> is simultaneously happening on those submodules. The config option\n>>>> diff.ignoreSubmodules is not appropriate for this use because it has larger\n>>>> implications.\n>>>\n>>> Wouldn't it be a lot better to instead add support for showing\n>>> submodule dirtyness as distinct from the main tree's dirtyness? Then\n>>> you could easily spot if you had either your tree / submodule tree\n>>> changes, without just ignoring them.\n>>\n>> That sounds like a good idea, but it doesn't necessarily have to come with\n>> this patch. Scott's use case here is he has a submodule that is _always_ dirty,\n>> and he simply doesn't want to see that stuff in the PS1. Having an option to\n>> show it separately would be very useful for me, but should perhaps be written\n>> as a separate patch.\n>\n> I'm not sure if I understand your case correctly, but if there is only one\n> submodule that is always dirty and everybody knows that but nobody cares,\n> won't it make sense to change the \"submodule.<name>.ignore\" config option\n> for that peculiar submodule via .git/config or .gitmodules?\n>\n\nIf I set the \"submodule.<name>.ignore\" then diffing around inside my\nhistory will not show the changes to that particular submodule.  That\nis what I meant by diff.ignoreSubmodules having larger implications.\n"},{"id":"157546","messageId":"4CFEA6FC.90008@web.de","threadId":"25979","inReplyTo":"AANLkTinnH4pFaEf=e4YE64f7cwLRx2R_2o_-=JGua30b@mail.gmail.com","subject":"Re: [PATCH] completion: Add PS1 configuration for submodules","fromName":"Jens Lehmann","fromEmail":"jens.lehmann@web.de","sentAt":"2010-12-07T21:28:28Z","receivedAt":"2010-12-07T21:28:28Z","isPatch":true,"sender":{"key":"jens.lehmann@web.de","avatar":"https://avatars.githubusercontent.com/u/135220?v=4"},"body":"Am 07.12.2010 22:17, schrieb Scott Kyle:\n> On Tue, Dec 7, 2010 at 1:08 PM, Jens Lehmann <Jens.Lehmann@web.de> wrote:\n>> Am 07.12.2010 21:31, schrieb Kevin Ballard:\n>>> On Dec 7, 2010, at 4:15 AM, Ęvar Arnfjörš Bjarmason wrote:\n>>>\n>>>> On Tue, Dec 7, 2010 at 00:22, Scott Kyle <scott@appden.com> wrote:\n>>>>> For those who often work on repositories with submodules, the dirty\n>>>>> indicator for unstaged changes will almost always show because development\n>>>>> is simultaneously happening on those submodules. The config option\n>>>>> diff.ignoreSubmodules is not appropriate for this use because it has larger\n>>>>> implications.\n>>>>\n>>>> Wouldn't it be a lot better to instead add support for showing\n>>>> submodule dirtyness as distinct from the main tree's dirtyness? Then\n>>>> you could easily spot if you had either your tree / submodule tree\n>>>> changes, without just ignoring them.\n>>>\n>>> That sounds like a good idea, but it doesn't necessarily have to come with\n>>> this patch. Scott's use case here is he has a submodule that is _always_ dirty,\n>>> and he simply doesn't want to see that stuff in the PS1. Having an option to\n>>> show it separately would be very useful for me, but should perhaps be written\n>>> as a separate patch.\n>>\n>> I'm not sure if I understand your case correctly, but if there is only one\n>> submodule that is always dirty and everybody knows that but nobody cares,\n>> won't it make sense to change the \"submodule.<name>.ignore\" config option\n>> for that peculiar submodule via .git/config or .gitmodules?\n>>\n> \n> If I set the \"submodule.<name>.ignore\" then diffing around inside my\n> history will not show the changes to that particular submodule.  That\n> is what I meant by diff.ignoreSubmodules having larger implications.\n\nAh, seems I misunderstood your submodule being dirty as modified or\nuntracked files being present in it's work tree. But your submodules\nHEAD seems to differ from the commit recorded in the superproject,\nand then of course \"submodule.<name>.ignore=dirty\" won't help you.\n"},{"id":"157547","messageId":"20101207212949.GA25162@burratino","threadId":"25979","inReplyTo":"AANLkTinnH4pFaEf=e4YE64f7cwLRx2R_2o_-=JGua30b@mail.gmail.com","subject":"Re: [PATCH] completion: Add PS1 configuration for submodules","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-12-07T21:29:49Z","receivedAt":"2010-12-07T21:29:49Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Scott Kyle wrote:\n\n> If I set the \"submodule.<name>.ignore\" then diffing around inside my\n> history will not show the changes to that particular submodule.\n\nEven if you set it to \"dirty\"?\n"},{"id":"157553","messageId":"AANLkTinjzvCDjCFrvujdFPRZKo2vK_9_8j3ybLNAfFmE@mail.gmail.com","threadId":"25979","inReplyTo":"20101207212949.GA25162@burratino","subject":"Re: [PATCH] completion: Add PS1 configuration for submodules","fromName":"Scott Kyle","fromEmail":"scott@appden.com","sentAt":"2010-12-07T22:59:31Z","receivedAt":"2010-12-07T22:59:31Z","isPatch":true,"sender":{"key":"scott@appden.com","avatar":"https://gravatar.com/avatar/ebac99c82f8cdb7cd1bf934ed569cc0748a700e9e505a4c4decd1af9c9f57291?d=mp&s=160"},"body":"On Tue, Dec 7, 2010 at 1:29 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:\n> Scott Kyle wrote:\n>\n>> If I set the \"submodule.<name>.ignore\" then diffing around inside my\n>> history will not show the changes to that particular submodule.\n>\n> Even if you set it to \"dirty\"?\n>\n\nSetting it to \"dirty\" is far less disruptive, you're right, but that\nwouldn't do me much good since my submodules are often on different\nbranches while developing.\n"},{"id":"157563","messageId":"AANLkTi=y8NnCqzB28iHxWqUU0byVu7QUiApM0FYswOLj@mail.gmail.com","threadId":"25979","inReplyTo":"4F33DA75-D095-415D-99F8-5236D6F93EE1@sb.org","subject":"Re: [PATCH] completion: Add PS1 configuration for submodules","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-12-08T00:27:56Z","receivedAt":"2010-12-08T00:27:56Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Tue, Dec 7, 2010 at 21:41, Kevin Ballard <kevin@sb.org> wrote:\n> On Dec 7, 2010, at 12:37 PM, Scott Kyle wrote:\n>\n>> On Tue, Dec 7, 2010 at 4:15 AM, Ævar Arnfjörð Bjarmason\n>> <avarab@gmail.com> wrote:\n>>>\n>>> On Tue, Dec 7, 2010 at 00:22, Scott Kyle <scott@appden.com> wrote:\n>>>> For those who often work on repositories with submodules, the dirty\n>>>> indicator for unstaged changes will almost always show because development\n>>>> is simultaneously happening on those submodules. The config option\n>>>> diff.ignoreSubmodules is not appropriate for this use because it has larger\n>>>> implications.\n>>>\n>>> Wouldn't it be a lot better to instead add support for showing\n>>> submodule dirtyness as distinct from the main tree's dirtyness? Then\n>>> you could easily spot if you had either your tree / submodule tree\n>>> changes, without just ignoring them.\n>>\n>> I considered that, but thought it to be a rather disruptive change,\n>> and one that conceptually didn't work.  The way I see it, either\n>> somebody thinks of their repo as dirty when the submodules are dirty,\n>> or not. And I think since this behavior has perpetuated for so long,\n>> most users are content with how it currently works.  I, however, was\n>> not, and so that is why I added an option for people like me.\n>\n> The big win for such a change, from my perspective, is it tells me if I need\n> to do a `git submodule update --recursive`, or if I actually have dirty changes.\n> Because of that, if nobody else picks this up, I'll probably write a patch\n> to introduce such a config at some point in the future. But as I said before,\n> that's something that can be done later and doesn't need to affect this patch.\n\nYeah. I didn't mean to imply that the current patch wasn't useful. It\nalso is for people like Scott that just want to ignore submodules, but\nmost of us care about them being dirty.\n\nSo having support for both (ignoring and tracking) in __git_ps1 would\nbe great. It would be very useful if you or someone else could pick\nthis up.\n"},{"id":"157880","messageId":"20101212063848.GB17185@burratino","threadId":"25979","inReplyTo":"AANLkTinjzvCDjCFrvujdFPRZKo2vK_9_8j3ybLNAfFmE@mail.gmail.com","subject":"Re: [PATCH] completion: Add PS1 configuration for submodules","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-12-12T06:38:48Z","receivedAt":"2010-12-12T06:38:48Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Scott Kyle wrote:\n> On Tue, Dec 7, 2010 at 1:29 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:\n>> Scott Kyle wrote:\n\n>>> If I set the \"submodule.<name>.ignore\" then diffing around inside my\n>>> history will not show the changes to that particular submodule.\n>>\n>> Even if you set it to \"dirty\"?\n>\n> Setting it to \"dirty\" is far less disruptive, you're right, but that\n> wouldn't do me much good since my submodules are often on different\n> branches while developing.\n\nAh, I see now.  How about something like this?  Untested, just a\nvague sketch to show the idea.\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n Documentation/config.txt       |    4 +++-\n Documentation/diff-options.txt |    7 +++++--\n Documentation/git-status.txt   |   14 ++------------\n Documentation/gitmodules.txt   |    4 +++-\n diff-lib.c                     |    3 ++-\n diff.h                         |    3 ++-\n submodule.c                    |    4 ++++\n 7 files changed, 21 insertions(+), 18 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex 0f85793..b93e92b 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -1810,7 +1810,9 @@ submodule.<name>.update::\n submodule.<name>.ignore::\n \tDefines under what circumstances \"git status\" and the diff family show\n \ta submodule as modified. When set to \"all\", it will never be considered\n-\tmodified, \"dirty\" will ignore all changes to the submodules work tree and\n+\tmodified, \"worktree\" will ignore all changes in the work tree not\n+\tregistered in the superproject index, \"dirty\" will ignore all changes\n+\tto the submodules work tree and\n \ttakes only differences between the HEAD of the submodule and the commit\n \trecorded in the superproject into account. \"untracked\" will additionally\n \tlet submodules with modified tracked files in their work tree show up.\ndiff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt\nindex f3e9538..93fe084 100644\n--- a/Documentation/diff-options.txt\n+++ b/Documentation/diff-options.txt\n@@ -360,7 +360,8 @@ endif::git-format-patch[]\n \n --ignore-submodules[=<when>]::\n \tIgnore changes to submodules in the diff generation. <when> can be\n-\teither \"none\", \"untracked\", \"dirty\" or \"all\", which is the default\n+\teither \"none\", \"untracked\", \"dirty\", \"worktree\", or \"all\", which is\n+\tthe default.\n \tUsing \"none\" will consider the submodule modified when it either contains\n \tuntracked or modified files or its HEAD differs from the commit recorded\n \tin the superproject and can be used to override any settings of the\n@@ -369,7 +370,9 @@ endif::git-format-patch[]\n \tcontain untracked content (but they are still scanned for modified\n \tcontent). Using \"dirty\" ignores all changes to the work tree of submodules,\n \tonly changes to the commits stored in the superproject are shown (this was\n-\tthe behavior until 1.7.0). Using \"all\" hides all changes to submodules.\n+\tthe behavior until 1.7.0).  Using \"worktree\" submodules in the worktree are\n+\tnever considered dirty but diffs between old commits do not ignore\n+\tsubmodules.  Using \"all\" hides all changes to submodules.\n \n --src-prefix=<prefix>::\n \tShow the given source prefix instead of \"a/\".\ndiff --git a/Documentation/git-status.txt b/Documentation/git-status.txt\nindex dae190a..8c3b0ac 100644\n--- a/Documentation/git-status.txt\n+++ b/Documentation/git-status.txt\n@@ -55,18 +55,8 @@ specified.\n \n --ignore-submodules[=<when>]::\n \tIgnore changes to submodules when looking for changes. <when> can be\n-\teither \"none\", \"untracked\", \"dirty\" or \"all\", which is the default.\n-\tUsing \"none\" will consider the submodule modified when it either contains\n-\tuntracked or modified files or its HEAD differs from the commit recorded\n-\tin the superproject and can be used to override any settings of the\n-\t'ignore' option in linkgit:git-config[1] or linkgit:gitmodules[5]. When\n-\t\"untracked\" is used submodules are not considered dirty when they only\n-\tcontain untracked content (but they are still scanned for modified\n-\tcontent). Using \"dirty\" ignores all changes to the work tree of submodules,\n-\tonly changes to the commits stored in the superproject are shown (this was\n-\tthe behavior before 1.7.0). Using \"all\" hides all changes to submodules\n-\t(and suppresses the output of submodule summaries when the config option\n-\t`status.submodulesummary` is set).\n+\teither \"none\", \"untracked\", \"dirty\", \"worktree\", or \"all\",\n+\twhich is the default.  See linkgit:git-diff[1] for details.\n \n -z::\n \tTerminate entries with NUL, instead of LF.  This implies\ndiff --git a/Documentation/gitmodules.txt b/Documentation/gitmodules.txt\nindex bcffd95..02185c4 100644\n--- a/Documentation/gitmodules.txt\n+++ b/Documentation/gitmodules.txt\n@@ -47,7 +47,9 @@ submodule.<name>.update::\n submodule.<name>.ignore::\n \tDefines under what circumstances \"git status\" and the diff family show\n \ta submodule as modified. When set to \"all\", it will never be considered\n-\tmodified, \"dirty\" will ignore all changes to the submodules work tree and\n+\tmodified; with \"worktree\", changes in the superproject index are\n+\tsignificant but in the subprojects are not;\n+\t\"dirty\" will ignore all changes to the submodules work tree and\n \ttakes only differences between the HEAD of the submodule and the commit\n \trecorded in the superproject into account. \"untracked\" will additionally\n \tlet submodules with modified tracked files in their work tree show up.\ndiff --git a/diff-lib.c b/diff-lib.c\nindex 392ce2b..39fa605 100644\n--- a/diff-lib.c\n+++ b/diff-lib.c\n@@ -72,7 +72,8 @@ static int match_stat_with_submodule(struct diff_options *diffopt,\n \t\tunsigned orig_flags = diffopt->flags;\n \t\tif (!DIFF_OPT_TST(diffopt, OVERRIDE_SUBMODULE_CONFIG))\n \t\t\tset_diffopt_flags_from_submodule_config(diffopt, ce->name);\n-\t\tif (DIFF_OPT_TST(diffopt, IGNORE_SUBMODULES))\n+\t\tif (DIFF_OPT_TST(diffopt, IGNORE_SUBMODULES) ||\n+\t\t    DIFF_OPT_TST(diffopt, IGNORE_WT_SUBMODULES))\n \t\t\tchanged = 0;\n \t\telse if (!DIFF_OPT_TST(diffopt, IGNORE_DIRTY_SUBMODULES)\n \t\t    && (!changed || DIFF_OPT_TST(diffopt, DIRTY_SUBMODULES)))\ndiff --git a/diff.h b/diff.h\nindex 0083d92..3b835ce 100644\n--- a/diff.h\n+++ b/diff.h\n@@ -77,7 +77,8 @@ typedef struct strbuf *(*diff_prefix_fn_t)(struct diff_options *opt, void *data)\n #define DIFF_OPT_DIRTY_SUBMODULES    (1 << 24)\n #define DIFF_OPT_IGNORE_UNTRACKED_IN_SUBMODULES (1 << 25)\n #define DIFF_OPT_IGNORE_DIRTY_SUBMODULES (1 << 26)\n-#define DIFF_OPT_OVERRIDE_SUBMODULE_CONFIG (1 << 27)\n+#define DIFF_OPT_IGNORE_WT_SUBMODULES (1 << 27)\n+#define DIFF_OPT_OVERRIDE_SUBMODULE_CONFIG (1 << 28)\n \n #define DIFF_OPT_TST(opts, flag)    ((opts)->flags & DIFF_OPT_##flag)\n #define DIFF_OPT_SET(opts, flag)    ((opts)->flags |= DIFF_OPT_##flag)\ndiff --git a/submodule.c b/submodule.c\nindex 91a4758..81a99bd 100644\n--- a/submodule.c\n+++ b/submodule.c\n@@ -102,6 +102,7 @@ int parse_submodule_config_option(const char *var, const char *value)\n \t\tstrbuf_release(&submodname);\n \t} else if ((len > 7) && !strcmp(var + len - 7, \".ignore\")) {\n \t\tif (strcmp(value, \"untracked\") && strcmp(value, \"dirty\") &&\n+\t\t    strcmp(value, \"worktree\") &&\n \t\t    strcmp(value, \"all\") && strcmp(value, \"none\")) {\n \t\t\twarning(\"Invalid parameter \\\"%s\\\" for config option \\\"submodule.%s.ignore\\\"\", value, var);\n \t\t\treturn 0;\n@@ -127,6 +128,7 @@ void handle_ignore_submodules_arg(struct diff_options *diffopt,\n \tDIFF_OPT_CLR(diffopt, IGNORE_SUBMODULES);\n \tDIFF_OPT_CLR(diffopt, IGNORE_UNTRACKED_IN_SUBMODULES);\n \tDIFF_OPT_CLR(diffopt, IGNORE_DIRTY_SUBMODULES);\n+\tDIFF_OPT_CLR(diffopt, IGNORE_WT_SUBMODULES);\n \n \tif (!strcmp(arg, \"all\"))\n \t\tDIFF_OPT_SET(diffopt, IGNORE_SUBMODULES);\n@@ -134,6 +136,8 @@ void handle_ignore_submodules_arg(struct diff_options *diffopt,\n \t\tDIFF_OPT_SET(diffopt, IGNORE_UNTRACKED_IN_SUBMODULES);\n \telse if (!strcmp(arg, \"dirty\"))\n \t\tDIFF_OPT_SET(diffopt, IGNORE_DIRTY_SUBMODULES);\n+\telse if (!strcmp(arg, \"worktree\"))\n+\t\tDIFF_OPT_SET(diffopt, IGNORE_WT_SUBMODULES);\n \telse if (strcmp(arg, \"none\"))\n \t\tdie(\"bad --ignore-submodules argument: %s\", arg);\n }\n-- \n1.7.2.4\n"},{"id":"157983","messageId":"4D06621F.6010101@web.de","threadId":"25979","inReplyTo":"20101212063848.GB17185@burratino","subject":"Re: [PATCH] completion: Add PS1 configuration for submodules","fromName":"Jens Lehmann","fromEmail":"jens.lehmann@web.de","sentAt":"2010-12-13T18:12:47Z","receivedAt":"2010-12-13T18:12:47Z","isPatch":true,"sender":{"key":"jens.lehmann@web.de","avatar":"https://avatars.githubusercontent.com/u/135220?v=4"},"body":"Am 12.12.2010 07:38, schrieb Jonathan Nieder:\n> Scott Kyle wrote:\n>> On Tue, Dec 7, 2010 at 1:29 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:\n>>> Scott Kyle wrote:\n> \n>>>> If I set the \"submodule.<name>.ignore\" then diffing around inside my\n>>>> history will not show the changes to that particular submodule.\n>>>\n>>> Even if you set it to \"dirty\"?\n>>\n>> Setting it to \"dirty\" is far less disruptive, you're right, but that\n>> wouldn't do me much good since my submodules are often on different\n>> branches while developing.\n> \n> Ah, I see now.  How about something like this?  Untested, just a\n> vague sketch to show the idea.\n\nMe thinks your proposal of a new \"worktree\" option makes sense. Let's\nhear what Scott says ...\n"},{"id":"158464","messageId":"AANLkTimCjRq=rJ5FA7QRCyp=7B8q5R7AtuVPiTimwVR8@mail.gmail.com","threadId":"25979","inReplyTo":"4D06621F.6010101@web.de","subject":"Re: [PATCH] completion: Add PS1 configuration for submodules","fromName":"Scott Kyle","fromEmail":"scott@appden.com","sentAt":"2010-12-21T22:56:22Z","receivedAt":"2010-12-21T22:56:22Z","isPatch":true,"sender":{"key":"scott@appden.com","avatar":"https://gravatar.com/avatar/ebac99c82f8cdb7cd1bf934ed569cc0748a700e9e505a4c4decd1af9c9f57291?d=mp&s=160"},"body":"On Mon, Dec 13, 2010 at 10:12 AM, Jens Lehmann <Jens.Lehmann@web.de> wrote:\n> Am 12.12.2010 07:38, schrieb Jonathan Nieder:\n>> Scott Kyle wrote:\n>>> On Tue, Dec 7, 2010 at 1:29 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:\n>>>> Scott Kyle wrote:\n>>\n>>>>> If I set the \"submodule.<name>.ignore\" then diffing around inside my\n>>>>> history will not show the changes to that particular submodule.\n>>>>\n>>>> Even if you set it to \"dirty\"?\n>>>\n>>> Setting it to \"dirty\" is far less disruptive, you're right, but that\n>>> wouldn't do me much good since my submodules are often on different\n>>> branches while developing.\n>>\n>> Ah, I see now.  How about something like this?  Untested, just a\n>> vague sketch to show the idea.\n>\n> Me thinks your proposal of a new \"worktree\" option makes sense. Let's\n> hear what Scott says ...\n>\n\nI mostly really like how 'worktree' can let me focus in on only the\nsubmodules I care about.  The drawback is that git status would no\nlonger list my true status.  I know that may sound hypocritical, but I\nintended for this patch to only affect my PS1.  At the same time, I\nwould like to see the 'worktree' patch taken, regardless of whether\nyou guys find mine useful.\n"}]}