{"thread":{"id":"42359","subject":"[PATCH v3] Ignore dirty submodule states during stash","startedAt":"2016-05-17T18:07:05Z","lastAt":"2016-05-17T18:07:05Z","messageCount":1,"participants":["Vasily Titskiy"],"isPatch":true,"patchVersion":3,"patchTotal":null},"messages":[{"id":"286810","messageId":"20160517180704.GA11769@gmail.com","threadId":"42359","inReplyTo":null,"subject":"[PATCH v3] Ignore dirty submodule states during stash","fromName":"Vasily Titskiy","fromEmail":"qehgt0@gmail.com","sentAt":"2016-05-17T18:07:05Z","receivedAt":"2016-05-17T18:07:05Z","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 conflicts\nin submodules.\n\nSigned-off-by: Vasily Titskiy <qehgt0@gmail.com>\n---\n git-stash.sh     |  2 +-\n t/t3903-stash.sh | 33 +++++++++++++++++++++++++++++++++\n 2 files changed, 34 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..dfe39a4 100755\n--- a/t/t3903-stash.sh\n+++ b/t/t3903-stash.sh\n@@ -731,4 +731,37 @@ 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 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"}]}