{"thread":{"id":"44948","subject":"[PATCH 4/4] git-prompt.sh: add tests for submodule indicator","startedAt":"2017-01-22T23:11:42Z","lastAt":"2017-01-22T23:11:42Z","messageCount":1,"participants":["Benjamin Fuchs"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"309964","messageId":"1485126679-7629-1-git-send-email-email@benjaminfuchs.de","threadId":"44948","inReplyTo":null,"subject":"[PATCH 4/4] git-prompt.sh: add tests for submodule indicator","fromName":"Benjamin Fuchs","fromEmail":"email@benjaminfuchs.de","sentAt":"2017-01-22T23:11:19Z","receivedAt":"2017-01-22T23:11:42Z","isPatch":true,"sender":{"key":"email@benjaminfuchs.de","avatar":null},"body":"---\n t/t9903-bash-prompt.sh | 43 +++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 43 insertions(+)\n\ndiff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh\nindex 97c9b32..4dce366 100755\n--- a/t/t9903-bash-prompt.sh\n+++ b/t/t9903-bash-prompt.sh\n@@ -37,6 +37,11 @@ test_expect_success 'setup for prompt tests' '\n \tgit commit -m \"yet another b2\" file &&\n \tmkdir ignored_dir &&\n \techo \"ignored_dir/\" >>.gitignore &&\n+\tgit checkout -b submodule &&\n+\tgit submodule add ./. sub &&\n+\tgit -C sub checkout master &&\n+\tgit add sub &&\n+\tgit commit -m submodule &&\n \tgit checkout master\n '\n \n@@ -755,4 +760,42 @@ test_expect_success 'prompt - hide if pwd ignored - inside gitdir (stderr)' '\n \ttest_cmp expected \"$actual\"\n '\n \n+test_expect_success 'prompt - submodule indicator' '\n+\tprintf \" (sub:master)\" >expected &&\n+\tgit checkout submodule &&\n+\ttest_when_finished \"git checkout master\" &&\n+\t(\n+\t\tcd sub &&\n+\t\tGIT_PS1_SHOWSUBMODULE=1 &&\n+\t\t__git_ps1 >\"$actual\"\n+\t) &&\n+\ttest_cmp expected \"$actual\"\n+'\n+\n+test_expect_success 'prompt - submodule indicator - verify false' '\n+\tprintf \" (master)\" >expected &&\n+\tgit checkout submodule &&\n+\ttest_when_finished \"git checkout master\" &&\n+\t(\n+\t\tcd sub &&\n+\t\tGIT_PS1_SHOWSUBMODULE= &&\n+\t\t__git_ps1 >\"$actual\"\n+\t) &&\n+\ttest_cmp expected \"$actual\"\n+'\n+\n+test_expect_success 'prompt - submodule indicator - dirty status indicator' '\n+\tprintf \" (+sub:b1)\" >expected &&\n+\tgit checkout submodule &&\n+\tgit -C sub checkout b1 &&\n+\ttest_when_finished \"git checkout master\" &&\n+\t(\n+\t\tcd sub &&\n+\t\tGIT_PS1_SHOWSUBMODULE=1 &&\n+\t\t__git_ps1 >\"$actual\"\n+\t) &&\n+\ttest_cmp expected \"$actual\"\n+'\n+\n+\n test_done\n-- \n2.7.4\n\n"}]}