{"thread":{"id":"42357","subject":"[PATCH v2] Ignore dirty submodule states during stash","startedAt":"2016-05-17T13:16:35Z","lastAt":"2016-05-17T17:12:12Z","messageCount":6,"participants":["Vasily Titskiy","Junio C Hamano","Eric Sunshine"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"286789","messageId":"20160517131635.GA5299@gmail.com","threadId":"42357","inReplyTo":null,"subject":"[PATCH v2] Ignore dirty submodule states during stash","fromName":"Vasily Titskiy","fromEmail":"qehgt0@gmail.com","sentAt":"2016-05-17T13:16:35Z","receivedAt":"2016-05-17T13:16:35Z","isPatch":true,"sender":{"key":"qehgt0@gmail.com","avatar":"https://gravatar.com/avatar/a8e2406642cc8b86fc31e7c8858f81d66604cb18719377eaa6afc91e134f34a9?d=mp&s=160"},"body":"As stash does not know how to deal with submodules,\nit should not try to save/restore their states\nas it leads to redundant merge conflicts.\n\nAdded test checks if 'stash pop' does not trigger merge conflics\nin submodules.\n\nSigned-off-by: Vasily Titskiy <qehgt0@gmail.com>\n---\n git-stash.sh     |  2 +-\n t/t3903-stash.sh | 34 ++++++++++++++++++++++++++++++++++\n 2 files changed, 35 insertions(+), 1 deletion(-)\n\ndiff --git a/git-stash.sh b/git-stash.sh\nindex c7c65e2..b500c44 100755\n--- a/git-stash.sh\n+++ b/git-stash.sh\n@@ -116,7 +116,7 @@ create_stash () {\n \t\t\tgit read-tree --index-output=\"$TMPindex\" -m $i_tree &&\n \t\t\tGIT_INDEX_FILE=\"$TMPindex\" &&\n \t\t\texport GIT_INDEX_FILE &&\n-\t\t\tgit diff --name-only -z HEAD -- >\"$TMP-stagenames\" &&\n+\t\t\tgit diff --name-only --ignore-submodules -z HEAD -- >\"$TMP-stagenames\" &&\n \t\t\tgit update-index -z --add --remove --stdin <\"$TMP-stagenames\" &&\n \t\t\tgit write-tree &&\n \t\t\trm -f \"$TMPindex\"\ndiff --git a/t/t3903-stash.sh b/t/t3903-stash.sh\nindex 2142c1f..1be62f3 100755\n--- a/t/t3903-stash.sh\n+++ b/t/t3903-stash.sh\n@@ -731,4 +731,38 @@ test_expect_success 'stash list --cc shows combined diff' '\n \ttest_cmp expect actual\n '\n \n+test_expect_success 'stash ignores changes in submodules' '\n+\tgit submodule init &&\n+\tgit init sub1 &&\n+\t(\n+\t\tcd sub1 &&\n+\t\techo \"x\" >file1 &&\n+\t\tgit add file1 &&\n+\t\tgit commit -a -m \"initial sub1\"\n+\t) &&\n+\tgit submodule add ./. sub1 &&\n+\techo \"main\" >file1 &&\n+\tgit add file1 &&\n+\tgit commit -a -m \"initial main\" &&\n+\t# make changes in submodule\n+\t(\n+\t\tcd sub1 &&\n+\t\techo \"y\" >>file1 &&\n+\t\tgit commit -a -m \"change y\"\n+\t) &&\n+\tgit commit sub1 -m \"update reference\" &&\n+\t# switch submodule to another revision\n+\t(\n+\t\tcd sub1 &&\n+\t\techo \"z\" >>file1 &&\n+\t\tgit commit -a -m \"change z\"\n+\t) &&\n+\t# everything is prepared, check if changes in submodules are ignored\n+\techo \"local change\" >>file1 &&\n+\tgit stash save &&\n+\tgit checkout HEAD~1 &&\n+\tgit submodule update &&\n+\tgit stash pop\n+'\n+\n test_done\n-- \n2.1.4\n"},{"id":"286791","messageId":"xmqqmvnoy82r.fsf@gitster.mtv.corp.google.com","threadId":"42357","inReplyTo":"20160517131635.GA5299@gmail.com","subject":"Re: [PATCH v2] Ignore dirty submodule states during stash","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-05-17T16:15:24Z","receivedAt":"2016-05-17T16:15:24Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Vasily Titskiy <qehgt0@gmail.com> writes:\n\n> diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh\n> index 2142c1f..1be62f3 100755\n> --- a/t/t3903-stash.sh\n> +++ b/t/t3903-stash.sh\n> @@ -731,4 +731,38 @@ test_expect_success 'stash list --cc shows combined diff' '\n>  \ttest_cmp expect actual\n>  '\n>  \n> +test_expect_success 'stash ignores changes in submodules' '\n> +\tgit submodule init &&\n\nHmmmm... what is this \"submodule init\" needed for at this point in\nthe test sequence?\n\n> +\tgit init sub1 &&\n> +\t(\n> +\t\tcd sub1 &&\n> +\t\techo \"x\" >file1 &&\n> +\t\tgit add file1 &&\n> +\t\tgit commit -a -m \"initial sub1\"\n> +\t) &&\n> +\tgit submodule add ./. sub1 &&\n> +\techo \"main\" >file1 &&\n> +\tgit add file1 &&\n> +\tgit commit -a -m \"initial main\" &&\n> +\t# make changes in submodule\n> +\t(\n> +\t\tcd sub1 &&\n> +\t\techo \"y\" >>file1 &&\n> +\t\tgit commit -a -m \"change y\"\n> +\t) &&\n> +\tgit commit sub1 -m \"update reference\" &&\n> +\t# switch submodule to another revision\n> +\t(\n> +\t\tcd sub1 &&\n> +\t\techo \"z\" >>file1 &&\n> +\t\tgit commit -a -m \"change z\"\n> +\t) &&\n> +\t# everything is prepared, check if changes in submodules are ignored\n> +\techo \"local change\" >>file1 &&\n> +\tgit stash save &&\n> +\tgit checkout HEAD~1 &&\n> +\tgit submodule update &&\n> +\tgit stash pop\n> +'\n> +\n>  test_done\n"},{"id":"286795","messageId":"CABSveYgsRU+L5qvY_evwekaRU7-oL_2Mmxt6L1u2dYM7Xfq2rw@mail.gmail.com","threadId":"42357","inReplyTo":"xmqqmvnoy82r.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH v2] Ignore dirty submodule states during stash","fromName":"Vasily Titskiy","fromEmail":"qehgt0@gmail.com","sentAt":"2016-05-17T16:38:19Z","receivedAt":"2016-05-17T16:38:19Z","isPatch":true,"sender":{"key":"qehgt0@gmail.com","avatar":"https://gravatar.com/avatar/a8e2406642cc8b86fc31e7c8858f81d66604cb18719377eaa6afc91e134f34a9?d=mp&s=160"},"body":"Hi Junio,\n\nYou're right, it's redundant here. Should I resubmit the path without this line?\n\n--\n  Regards,\n  Vasily Titskiy\n\nOn Tue, May 17, 2016 at 12:15 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Vasily Titskiy <qehgt0@gmail.com> writes:\n>\n> > diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh\n> > index 2142c1f..1be62f3 100755\n> > --- a/t/t3903-stash.sh\n> > +++ b/t/t3903-stash.sh\n> > @@ -731,4 +731,38 @@ test_expect_success 'stash list --cc shows combined diff' '\n> >       test_cmp expect actual\n> >  '\n> >\n> > +test_expect_success 'stash ignores changes in submodules' '\n> > +     git submodule init &&\n>\n> Hmmmm... what is this \"submodule init\" needed for at this point in\n> the test sequence?\n>\n> > +     git init sub1 &&\n> > +     (\n> > +             cd sub1 &&\n> > +             echo \"x\" >file1 &&\n> > +             git add file1 &&\n> > +             git commit -a -m \"initial sub1\"\n> > +     ) &&\n> > +     git submodule add ./. sub1 &&\n> > +     echo \"main\" >file1 &&\n> > +     git add file1 &&\n> > +     git commit -a -m \"initial main\" &&\n> > +     # make changes in submodule\n> > +     (\n> > +             cd sub1 &&\n> > +             echo \"y\" >>file1 &&\n> > +             git commit -a -m \"change y\"\n> > +     ) &&\n> > +     git commit sub1 -m \"update reference\" &&\n> > +     # switch submodule to another revision\n> > +     (\n> > +             cd sub1 &&\n> > +             echo \"z\" >>file1 &&\n> > +             git commit -a -m \"change z\"\n> > +     ) &&\n> > +     # everything is prepared, check if changes in submodules are ignored\n> > +     echo \"local change\" >>file1 &&\n> > +     git stash save &&\n> > +     git checkout HEAD~1 &&\n> > +     git submodule update &&\n> > +     git stash pop\n> > +'\n> > +\n> >  test_done\n"},{"id":"286797","messageId":"CAPig+cSFD+4zhvxpqjGWomq1uW3JxCNi6pQP3f_bp4Tr1Kg5aA@mail.gmail.com","threadId":"42357","inReplyTo":"20160517131635.GA5299@gmail.com","subject":"Re: [PATCH v2] Ignore dirty submodule states during stash","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2016-05-17T16:58:08Z","receivedAt":"2016-05-17T16:58:08Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Tue, May 17, 2016 at 9:16 AM, Vasily Titskiy <qehgt0@gmail.com> wrote:\n> As stash does not know how to deal with submodules,\n> it should not try to save/restore their states\n> as it leads to redundant merge conflicts.\n>\n> Added test checks if 'stash pop' does not trigger merge conflics\n\n/conflics/conflicts/\n\n> in submodules.\n>\n> Signed-off-by: Vasily Titskiy <qehgt0@gmail.com>\n"},{"id":"286800","messageId":"xmqqa8joy5sv.fsf@gitster.mtv.corp.google.com","threadId":"42357","inReplyTo":"CABSveYgsRU+L5qvY_evwekaRU7-oL_2Mmxt6L1u2dYM7Xfq2rw@mail.gmail.com","subject":"Re: [PATCH v2] Ignore dirty submodule states during stash","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-05-17T17:04:32Z","receivedAt":"2016-05-17T17:04:32Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Vasily Titskiy <qehgt0@gmail.com> writes:\n\n> You're right, it's redundant here. Should I resubmit the path without this line?\n\nI wasn't pointing out that it was not needed.  I was only asking\nwhat it was meant to do.\n\nIf you now think it shouldn't have been there, that merely means\nyour code was wrong.  It does not mean I'm right ;-)\n\nWith that line removed, would the patch now becomes right?  Are\nthere other bugs?\n"},{"id":"286801","messageId":"CABSveYjmqrPY4OVrYnWeCrjAqZdqOaciCzQ2_soB4akOcQgZpQ@mail.gmail.com","threadId":"42357","inReplyTo":"xmqqa8joy5sv.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH v2] Ignore dirty submodule states during stash","fromName":"Vasily Titskiy","fromEmail":"qehgt0@gmail.com","sentAt":"2016-05-17T17:12:12Z","receivedAt":"2016-05-17T17:12:12Z","isPatch":true,"sender":{"key":"qehgt0@gmail.com","avatar":"https://gravatar.com/avatar/a8e2406642cc8b86fc31e7c8858f81d66604cb18719377eaa6afc91e134f34a9?d=mp&s=160"},"body":"The command does nothing, so it's not needed. There is also a typo in\nmy patch description, so I'll resend it again with needed changes.\n--\n  Regards,\n  Vasily Titskiy\n\n\nOn Tue, May 17, 2016 at 1:04 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Vasily Titskiy <qehgt0@gmail.com> writes:\n>\n>> You're right, it's redundant here. Should I resubmit the path without this line?\n>\n> I wasn't pointing out that it was not needed.  I was only asking\n> what it was meant to do.\n>\n> If you now think it shouldn't have been there, that merely means\n> your code was wrong.  It does not mean I'm right ;-)\n>\n> With that line removed, would the patch now becomes right?  Are\n> there other bugs?\n"}]}