{"thread":{"id":"32890","subject":"[PATCH 0/2] Add bash.showUntrackedFiles config option","startedAt":"2013-02-12T20:12:14Z","lastAt":"2013-02-13T20:58:19Z","messageCount":20,"participants":["Martin Erik Werner","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"209397","messageId":"1360699936-28688-1-git-send-email-martinerikwerner@gmail.com","threadId":"32890","inReplyTo":null,"subject":"[PATCH 0/2] Add bash.showUntrackedFiles config option","fromName":"Martin Erik Werner","fromEmail":"martinerikwerner@gmail.com","sentAt":"2013-02-12T20:12:14Z","receivedAt":"2013-02-12T20:12:14Z","isPatch":true,"sender":{"key":"martinerikwerner@gmail.com","avatar":"https://avatars.githubusercontent.com/u/732190?v=4"},"body":"Hi,\n\nHere is a patch adding a config option for showing untracked files in\nthe shell prompt, I've noticed having it enabled tends to make the\nprompt act very sluggish in some cases (large repos / unfriendly\nfilesystems). So it would be nice to have a more fine-grained control\nover it, similar to what exists for bash.showDirtyState.\n\nMartin Erik Werner (2):\n  bash completion: add bash.showUntrackedFiles option\n  t9903: add test case for bash.showUntrackedFiles\n\n contrib/completion/git-prompt.sh |   11 ++++++++---\n t/t9903-bash-prompt.sh           |   11 +++++++++++\n 2 files changed, 19 insertions(+), 3 deletions(-)\n\n-- \n1.7.10.4\n"},{"id":"209398","messageId":"1360699936-28688-2-git-send-email-martinerikwerner@gmail.com","threadId":"32890","inReplyTo":"1360699936-28688-1-git-send-email-martinerikwerner@gmail.com","subject":"[PATCH 1/2] bash completion: add bash.showUntrackedFiles option","fromName":"Martin Erik Werner","fromEmail":"martinerikwerner@gmail.com","sentAt":"2013-02-12T20:12:15Z","receivedAt":"2013-02-12T20:12:15Z","isPatch":true,"sender":{"key":"martinerikwerner@gmail.com","avatar":"https://avatars.githubusercontent.com/u/732190?v=4"},"body":"Add a config option 'bash.showUntrackedFiles' which allows enabling\nthe prompt showing untracked files on a per-repository basis. This is\nuseful for some repositories where the 'git ls-files ...' command may\ntake a long time.\n\nSigned-off-by: Martin Erik Werner <martinerikwerner@gmail.com>\n---\n contrib/completion/git-prompt.sh |   11 ++++++++---\n 1 file changed, 8 insertions(+), 3 deletions(-)\n\ndiff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh\nindex 9bef053..9b2eec2 100644\n--- a/contrib/completion/git-prompt.sh\n+++ b/contrib/completion/git-prompt.sh\n@@ -43,7 +43,10 @@\n #\n # If you would like to see if there're untracked files, then you can set\n # GIT_PS1_SHOWUNTRACKEDFILES to a nonempty value. If there're untracked\n-# files, then a '%' will be shown next to the branch name.\n+# files, then a '%' will be shown next to the branch name.  You can\n+# configure this per-repository with the bash.showUntrackedFiles\n+# variable, which defaults to true once GIT_PS1_SHOWUNTRACKEDFILES is\n+# enabled.\n #\n # If you would like to see the difference between HEAD and its upstream,\n # set GIT_PS1_SHOWUPSTREAM=\"auto\".  A \"<\" indicates you are behind, \">\"\n@@ -332,8 +335,10 @@ __git_ps1 ()\n \t\t\tfi\n \n \t\t\tif [ -n \"${GIT_PS1_SHOWUNTRACKEDFILES-}\" ]; then\n-\t\t\t\tif [ -n \"$(git ls-files --others --exclude-standard)\" ]; then\n-\t\t\t\t\tu=\"%\"\n+\t\t\t\tif [ \"$(git config --bool bash.showUntrackedFiles)\" != \"false\" ]; then\n+\t\t\t\t\tif [ -n \"$(git ls-files --others --exclude-standard)\" ]; then\n+\t\t\t\t\t\tu=\"%\"\n+\t\t\t\t\tfi\n \t\t\t\tfi\n \t\t\tfi\n \n-- \n1.7.10.4\n"},{"id":"209399","messageId":"1360699936-28688-3-git-send-email-martinerikwerner@gmail.com","threadId":"32890","inReplyTo":"1360699936-28688-1-git-send-email-martinerikwerner@gmail.com","subject":"[PATCH 2/2] t9903: add test case for bash.showUntrackedFiles","fromName":"Martin Erik Werner","fromEmail":"martinerikwerner@gmail.com","sentAt":"2013-02-12T20:12:16Z","receivedAt":"2013-02-12T20:12:16Z","isPatch":true,"sender":{"key":"martinerikwerner@gmail.com","avatar":"https://avatars.githubusercontent.com/u/732190?v=4"},"body":"Add a test case for the bash.showUntrackedFiles config option, which\nchecks that the config option can disable the global effect of the\nGIT_PS1_SHOWUNTRACKEDFILES environmant variable.\n\nSigned-off-by: Martin Erik Werner <martinerikwerner@gmail.com>\n---\n t/t9903-bash-prompt.sh |   11 +++++++++++\n 1 file changed, 11 insertions(+)\n\ndiff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh\nindex f17c1f8..c9417b9 100755\n--- a/t/t9903-bash-prompt.sh\n+++ b/t/t9903-bash-prompt.sh\n@@ -447,6 +447,17 @@ test_expect_success 'prompt - untracked files status indicator - not shown insid\n \ttest_cmp expected \"$actual\"\n '\n \n+test_expect_success 'prompt - untracked files status indicator - disabled by config' '\n+\tprintf \" (master)\" > expected &&\n+\techo \"untracked\" > file_untracked &&\n+\ttest_config bash.showUntrackedFiles false &&\n+\t(\n+\t\tGIT_PS1_SHOWUNTRACKEDFILES=y &&\n+\t\t__git_ps1 > \"$actual\"\n+\t) &&\n+\ttest_cmp expected \"$actual\"\n+'\n+\n test_expect_success 'prompt - format string starting with dash' '\n \tprintf -- \"-master\" > expected &&\n \t__git_ps1 \"-%s\" > \"$actual\" &&\n-- \n1.7.10.4\n"},{"id":"209421","messageId":"7vwquddvnz.fsf@alter.siamese.dyndns.org","threadId":"32890","inReplyTo":"1360699936-28688-2-git-send-email-martinerikwerner@gmail.com","subject":"Re: [PATCH 1/2] bash completion: add bash.showUntrackedFiles option","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-02-12T22:17:20Z","receivedAt":"2013-02-12T22:17:20Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Martin Erik Werner <martinerikwerner@gmail.com> writes:\n\n> Add a config option 'bash.showUntrackedFiles' which allows enabling\n> the prompt showing untracked files on a per-repository basis. This is\n> useful for some repositories where the 'git ls-files ...' command may\n> take a long time.\n>\n> Signed-off-by: Martin Erik Werner <martinerikwerner@gmail.com>\n> ---\n\nOK.\n\nThe subject needs to be corrected, though ;-) No need to resend.\nI'll do s/completion/prompt/ while applying.\n\nThanks.\n\n>  contrib/completion/git-prompt.sh |   11 ++++++++---\n>  1 file changed, 8 insertions(+), 3 deletions(-)\n>\n> diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh\n> index 9bef053..9b2eec2 100644\n> --- a/contrib/completion/git-prompt.sh\n> +++ b/contrib/completion/git-prompt.sh\n> @@ -43,7 +43,10 @@\n>  #\n>  # If you would like to see if there're untracked files, then you can set\n>  # GIT_PS1_SHOWUNTRACKEDFILES to a nonempty value. If there're untracked\n> -# files, then a '%' will be shown next to the branch name.\n> +# files, then a '%' will be shown next to the branch name.  You can\n> +# configure this per-repository with the bash.showUntrackedFiles\n> +# variable, which defaults to true once GIT_PS1_SHOWUNTRACKEDFILES is\n> +# enabled.\n>  #\n>  # If you would like to see the difference between HEAD and its upstream,\n>  # set GIT_PS1_SHOWUPSTREAM=\"auto\".  A \"<\" indicates you are behind, \">\"\n> @@ -332,8 +335,10 @@ __git_ps1 ()\n>  \t\t\tfi\n>  \n>  \t\t\tif [ -n \"${GIT_PS1_SHOWUNTRACKEDFILES-}\" ]; then\n> -\t\t\t\tif [ -n \"$(git ls-files --others --exclude-standard)\" ]; then\n> -\t\t\t\t\tu=\"%\"\n> +\t\t\t\tif [ \"$(git config --bool bash.showUntrackedFiles)\" != \"false\" ]; then\n> +\t\t\t\t\tif [ -n \"$(git ls-files --others --exclude-standard)\" ]; then\n> +\t\t\t\t\t\tu=\"%\"\n> +\t\t\t\t\tfi\n>  \t\t\t\tfi\n>  \t\t\tfi\n"},{"id":"209423","messageId":"7vr4kldv2x.fsf@alter.siamese.dyndns.org","threadId":"32890","inReplyTo":"1360699936-28688-3-git-send-email-martinerikwerner@gmail.com","subject":"Re: [PATCH 2/2] t9903: add test case for bash.showUntrackedFiles","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-02-12T22:29:58Z","receivedAt":"2013-02-12T22:29:58Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Martin Erik Werner <martinerikwerner@gmail.com> writes:\n\n> Add a test case for the bash.showUntrackedFiles config option, which\n> checks that the config option can disable the global effect of the\n> GIT_PS1_SHOWUNTRACKEDFILES environmant variable.\n>\n> Signed-off-by: Martin Erik Werner <martinerikwerner@gmail.com>\n> ---\n>  t/t9903-bash-prompt.sh |   11 +++++++++++\n>  1 file changed, 11 insertions(+)\n>\n> diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh\n> index f17c1f8..c9417b9 100755\n> --- a/t/t9903-bash-prompt.sh\n> +++ b/t/t9903-bash-prompt.sh\n> @@ -447,6 +447,17 @@ test_expect_success 'prompt - untracked files status indicator - not shown insid\n>  \ttest_cmp expected \"$actual\"\n>  '\n>  \n> +test_expect_success 'prompt - untracked files status indicator - disabled by config' '\n> +\tprintf \" (master)\" > expected &&\n> +\techo \"untracked\" > file_untracked &&\n> +\ttest_config bash.showUntrackedFiles false &&\n> +\t(\n> +\t\tGIT_PS1_SHOWUNTRACKEDFILES=y &&\n> +\t\t__git_ps1 > \"$actual\"\n> +\t) &&\n> +\ttest_cmp expected \"$actual\"\n> +'\n\nAll six combinations need checking:\n\n * not having the configuration at all and not having the shell\n   variable should not show the untracked indicator (already tested).\n\n * not having the configuration at all and having the shell variable\n   should show the untracked indicator (already tested).\n\n * setting configuration to true without having the shell variable\n   should not show the untracked indicator.\n\n * setting configuration to true and having the shell variable\n   should show the unttracked indicator.\n\n * setting configuration to false and having the shell variable\n   should not show the untracked indicator (the above test checks\n   this).\n\n * setting configuration to false without having the shell variable\n   should not show the untracked indicator.\n\nto prevent others from breaking the code you wrote for [PATCH 1/2],\nso you need three more tests, I guess?\n"},{"id":"209458","messageId":"1360753138.25490.10.camel@mas","threadId":"32890","inReplyTo":"7vr4kldv2x.fsf@alter.siamese.dyndns.org","subject":"[PATCH v2 0/3] Add bash.showUntrackedFiles config option","fromName":"Martin Erik Werner","fromEmail":"martinerikwerner@gmail.com","sentAt":"2013-02-13T10:58:58Z","receivedAt":"2013-02-13T10:58:58Z","isPatch":true,"sender":{"key":"martinerikwerner@gmail.com","avatar":"https://avatars.githubusercontent.com/u/732190?v=4"},"body":"On Tue, 2013-02-12 at 14:29 -0800, Junio C Hamano wrote:\n> Martin Erik Werner <martinerikwerner@gmail.com> writes:\n> \n> > Add a test case for the bash.showUntrackedFiles config option, which\n> > checks that the config option can disable the global effect of the\n> > GIT_PS1_SHOWUNTRACKEDFILES environmant variable.\n> >\n> > Signed-off-by: Martin Erik Werner <martinerikwerner@gmail.com>\n> > ---\n> >  t/t9903-bash-prompt.sh |   11 +++++++++++\n> >  1 file changed, 11 insertions(+)\n> >\n> > diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh\n> > index f17c1f8..c9417b9 100755\n> > --- a/t/t9903-bash-prompt.sh\n> > +++ b/t/t9903-bash-prompt.sh\n> > @@ -447,6 +447,17 @@ test_expect_success 'prompt - untracked files status indicator - not shown insid\n> >  \ttest_cmp expected \"$actual\"\n> >  '\n> >  \n> > +test_expect_success 'prompt - untracked files status indicator - disabled by config' '\n> > +\tprintf \" (master)\" > expected &&\n> > +\techo \"untracked\" > file_untracked &&\n> > +\ttest_config bash.showUntrackedFiles false &&\n> > +\t(\n> > +\t\tGIT_PS1_SHOWUNTRACKEDFILES=y &&\n> > +\t\t__git_ps1 > \"$actual\"\n> > +\t) &&\n> > +\ttest_cmp expected \"$actual\"\n> > +'\n> \n> All six combinations need checking:\n> \n>  * not having the configuration at all and not having the shell\n>    variable should not show the untracked indicator (already tested).\n> \n>  * not having the configuration at all and having the shell variable\n>    should show the untracked indicator (already tested).\n> \n>  * setting configuration to true without having the shell variable\n>    should not show the untracked indicator.\n> \n>  * setting configuration to true and having the shell variable\n>    should show the unttracked indicator.\n> \n>  * setting configuration to false and having the shell variable\n>    should not show the untracked indicator (the above test checks\n>    this).\n> \n>  * setting configuration to false without having the shell variable\n>    should not show the untracked indicator.\n> \n> to prevent others from breaking the code you wrote for [PATCH 1/2],\n> so you need three more tests, I guess?\n\nAh, yes, I was mimicing what the test did for bash.showDirtyState, I've\nnow added the three extra tests for bash.showUntrackedFiles, which\nshould cover all of the above cases, hopefully?\n\nI've also added in the three extra tests for bash.showDirtyState,\nequivalently. These only cover the case of dirty files and not\ncombinations with content in index, which I felt was a bit overkill, is\nthat reasonable?\n\nThanks for the review :)\n\n-- \nMartin Erik Werner <martinerikwerner@gmail.com>\n"},{"id":"209459","messageId":"1360753321-5002-1-git-send-email-martinerikwerner@gmail.com","threadId":"32890","inReplyTo":"1360753138.25490.10.camel@mas","subject":"[PATCH v2 1/3] shell prompt: add bash.showUntrackedFiles option","fromName":"Martin Erik Werner","fromEmail":"martinerikwerner@gmail.com","sentAt":"2013-02-13T11:01:58Z","receivedAt":"2013-02-13T11:01:58Z","isPatch":true,"sender":{"key":"martinerikwerner@gmail.com","avatar":"https://avatars.githubusercontent.com/u/732190?v=4"},"body":"Add a config option 'bash.showUntrackedFiles' which allows enabling\nthe prompt showing untracked files on a per-repository basis. This is\nuseful for some repositories where the 'git ls-files ...' command may\ntake a long time.\n\nSigned-off-by: Martin Erik Werner <martinerikwerner@gmail.com>\n---\n contrib/completion/git-prompt.sh |   11 ++++++++---\n 1 file changed, 8 insertions(+), 3 deletions(-)\n\ndiff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh\nindex 9bef053..9b2eec2 100644\n--- a/contrib/completion/git-prompt.sh\n+++ b/contrib/completion/git-prompt.sh\n@@ -43,7 +43,10 @@\n #\n # If you would like to see if there're untracked files, then you can set\n # GIT_PS1_SHOWUNTRACKEDFILES to a nonempty value. If there're untracked\n-# files, then a '%' will be shown next to the branch name.\n+# files, then a '%' will be shown next to the branch name.  You can\n+# configure this per-repository with the bash.showUntrackedFiles\n+# variable, which defaults to true once GIT_PS1_SHOWUNTRACKEDFILES is\n+# enabled.\n #\n # If you would like to see the difference between HEAD and its upstream,\n # set GIT_PS1_SHOWUPSTREAM=\"auto\".  A \"<\" indicates you are behind, \">\"\n@@ -332,8 +335,10 @@ __git_ps1 ()\n \t\t\tfi\n \n \t\t\tif [ -n \"${GIT_PS1_SHOWUNTRACKEDFILES-}\" ]; then\n-\t\t\t\tif [ -n \"$(git ls-files --others --exclude-standard)\" ]; then\n-\t\t\t\t\tu=\"%\"\n+\t\t\t\tif [ \"$(git config --bool bash.showUntrackedFiles)\" != \"false\" ]; then\n+\t\t\t\t\tif [ -n \"$(git ls-files --others --exclude-standard)\" ]; then\n+\t\t\t\t\t\tu=\"%\"\n+\t\t\t\t\tfi\n \t\t\t\tfi\n \t\t\tfi\n \n-- \n1.7.10.4\n"},{"id":"209460","messageId":"1360753321-5002-2-git-send-email-martinerikwerner@gmail.com","threadId":"32890","inReplyTo":"1360753321-5002-1-git-send-email-martinerikwerner@gmail.com","subject":"[PATCH v2 2/3] t9903: add tests for bash.showUntrackedFiles","fromName":"Martin Erik Werner","fromEmail":"martinerikwerner@gmail.com","sentAt":"2013-02-13T11:01:59Z","receivedAt":"2013-02-13T11:01:59Z","isPatch":true,"sender":{"key":"martinerikwerner@gmail.com","avatar":"https://avatars.githubusercontent.com/u/732190?v=4"},"body":"Add 4 test for the bash.showUntrackedFiles config option, covering all\ncombinations of the shell var being set/unset and the config option\nbeing enabled/disabled.\n\nSigned-off-by: Martin Erik Werner <martinerikwerner@gmail.com>\n---\n t/t9903-bash-prompt.sh |   40 ++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 40 insertions(+)\n\ndiff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh\nindex f17c1f8..cb008e2 100755\n--- a/t/t9903-bash-prompt.sh\n+++ b/t/t9903-bash-prompt.sh\n@@ -437,6 +437,46 @@ test_expect_success 'prompt - untracked files status indicator - untracked files\n \ttest_cmp expected \"$actual\"\n '\n \n+test_expect_success 'prompt - untracked files status indicator - shell variable unset with config disabled' '\n+\tprintf \" (master)\" > expected &&\n+\ttest_config bash.showUntrackedFiles false &&\n+\t(\n+\t\tunset -v GIT_PS1_SHOWUNTRACKEDFILES &&\n+\t\t__git_ps1 > \"$actual\"\n+\t) &&\n+\ttest_cmp expected \"$actual\"\n+'\n+\n+test_expect_success 'prompt - untracked files status indicator - shell variable unset with config enabled' '\n+\tprintf \" (master)\" > expected &&\n+\ttest_config bash.showUntrackedFiles true &&\n+\t(\n+\t\tunset -v GIT_PS1_SHOWUNTRACKEDFILES &&\n+\t\t__git_ps1 > \"$actual\"\n+\t) &&\n+\ttest_cmp expected \"$actual\"\n+'\n+\n+test_expect_success 'prompt - untracked files status indicator - shell variable set with config disabled' '\n+\tprintf \" (master)\" > expected &&\n+\ttest_config bash.showUntrackedFiles false &&\n+\t(\n+\t\tGIT_PS1_SHOWUNTRACKEDFILES=y &&\n+\t\t__git_ps1 > \"$actual\"\n+\t) &&\n+\ttest_cmp expected \"$actual\"\n+'\n+\n+test_expect_success 'prompt - untracked files status indicator - shell variable set with config enabled' '\n+\tprintf \" (master %%)\" > expected &&\n+\ttest_config bash.showUntrackedFiles true &&\n+\t(\n+\t\tGIT_PS1_SHOWUNTRACKEDFILES=y &&\n+\t\t__git_ps1 > \"$actual\"\n+\t) &&\n+\ttest_cmp expected \"$actual\"\n+'\n+\n test_expect_success 'prompt - untracked files status indicator - not shown inside .git directory' '\n \tprintf \" (GIT_DIR!)\" > expected &&\n \t(\n-- \n1.7.10.4\n"},{"id":"209461","messageId":"1360753321-5002-3-git-send-email-martinerikwerner@gmail.com","threadId":"32890","inReplyTo":"1360753321-5002-1-git-send-email-martinerikwerner@gmail.com","subject":"[PATCH v2 3/3] t9903: add extra tests for bash.showDirtyState","fromName":"Martin Erik Werner","fromEmail":"martinerikwerner@gmail.com","sentAt":"2013-02-13T11:02:00Z","receivedAt":"2013-02-13T11:02:00Z","isPatch":true,"sender":{"key":"martinerikwerner@gmail.com","avatar":"https://avatars.githubusercontent.com/u/732190?v=4"},"body":"Added 3 extra tests for the bash.showDirtyState config option, tests\nshould now cover all combinations of the shell var being set/unset and\nthe config option being enabled/disabled, given a dirty file.\n\n* Renamed test 'disabled by config' to 'shell variable set with config\n  disabled' for consistency\n---\n t/t9903-bash-prompt.sh |   38 +++++++++++++++++++++++++++++++++++++-\n 1 file changed, 37 insertions(+), 1 deletion(-)\n\ndiff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh\nindex cb008e2..fa81b09 100755\n--- a/t/t9903-bash-prompt.sh\n+++ b/t/t9903-bash-prompt.sh\n@@ -360,12 +360,48 @@ test_expect_success 'prompt - dirty status indicator - before root commit' '\n \ttest_cmp expected \"$actual\"\n '\n \n-test_expect_success 'prompt - dirty status indicator - disabled by config' '\n+test_expect_success 'prompt - dirty status indicator - shell variable unset with config disabled' '\n \tprintf \" (master)\" > expected &&\n \techo \"dirty\" > file &&\n \ttest_when_finished \"git reset --hard\" &&\n \ttest_config bash.showDirtyState false &&\n \t(\n+\t\tunset -v GIT_PS1_SHOWDIRTYSTATE &&\n+\t\t__git_ps1 > \"$actual\"\n+\t) &&\n+\ttest_cmp expected \"$actual\"\n+'\n+\n+test_expect_success 'prompt - dirty status indicator - shell variable unset with config enabled' '\n+\tprintf \" (master)\" > expected &&\n+\techo \"dirty\" > file &&\n+\ttest_when_finished \"git reset --hard\" &&\n+\ttest_config bash.showDirtyState true &&\n+\t(\n+\t\tunset -v GIT_PS1_SHOWDIRTYSTATE &&\n+\t\t__git_ps1 > \"$actual\"\n+\t) &&\n+\ttest_cmp expected \"$actual\"\n+'\n+\n+test_expect_success 'prompt - dirty status indicator - shell variable set with config disabled' '\n+\tprintf \" (master)\" > expected &&\n+\techo \"dirty\" > file &&\n+\ttest_when_finished \"git reset --hard\" &&\n+\ttest_config bash.showDirtyState false &&\n+\t(\n+\t\tGIT_PS1_SHOWDIRTYSTATE=y &&\n+\t\t__git_ps1 > \"$actual\"\n+\t) &&\n+\ttest_cmp expected \"$actual\"\n+'\n+\n+test_expect_success 'prompt - dirty status indicator - shell variable set with config enabled' '\n+\tprintf \" (master *)\" > expected &&\n+\techo \"dirty\" > file &&\n+\ttest_when_finished \"git reset --hard\" &&\n+\ttest_config bash.showDirtyState true &&\n+\t(\n \t\tGIT_PS1_SHOWDIRTYSTATE=y &&\n \t\t__git_ps1 > \"$actual\"\n \t) &&\n-- \n1.7.10.4\n"},{"id":"209476","messageId":"7va9r8b3bx.fsf@alter.siamese.dyndns.org","threadId":"32890","inReplyTo":"1360753321-5002-1-git-send-email-martinerikwerner@gmail.com","subject":"Re: [PATCH v2 1/3] shell prompt: add bash.showUntrackedFiles option","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-02-13T16:12:18Z","receivedAt":"2013-02-13T16:12:18Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Martin Erik Werner <martinerikwerner@gmail.com> writes:\n\n> Add a config option 'bash.showUntrackedFiles' which allows enabling\n> the prompt showing untracked files on a per-repository basis. This is\n> useful for some repositories where the 'git ls-files ...' command may\n> take a long time.\n>\n> Signed-off-by: Martin Erik Werner <martinerikwerner@gmail.com>\n> ---\n>  contrib/completion/git-prompt.sh |   11 ++++++++---\n>  1 file changed, 8 insertions(+), 3 deletions(-)\n>\n> diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh\n> index 9bef053..9b2eec2 100644\n> --- a/contrib/completion/git-prompt.sh\n> +++ b/contrib/completion/git-prompt.sh\n> @@ -43,7 +43,10 @@\n>  #\n>  # If you would like to see if there're untracked files, then you can set\n>  # GIT_PS1_SHOWUNTRACKEDFILES to a nonempty value. If there're untracked\n> -# files, then a '%' will be shown next to the branch name.\n> +# files, then a '%' will be shown next to the branch name.  You can\n> +# configure this per-repository with the bash.showUntrackedFiles\n> +# variable, which defaults to true once GIT_PS1_SHOWUNTRACKEDFILES is\n> +# enabled.\n>  #\n>  # If you would like to see the difference between HEAD and its upstream,\n>  # set GIT_PS1_SHOWUPSTREAM=\"auto\".  A \"<\" indicates you are behind, \">\"\n> @@ -332,8 +335,10 @@ __git_ps1 ()\n>  \t\t\tfi\n>  \n>  \t\t\tif [ -n \"${GIT_PS1_SHOWUNTRACKEDFILES-}\" ]; then\n> -\t\t\t\tif [ -n \"$(git ls-files --others --exclude-standard)\" ]; then\n> -\t\t\t\t\tu=\"%\"\n> +\t\t\t\tif [ \"$(git config --bool bash.showUntrackedFiles)\" != \"false\" ]; then\n> +\t\t\t\t\tif [ -n \"$(git ls-files --others --exclude-standard)\" ]; then\n> +\t\t\t\t\t\tu=\"%\"\n> +\t\t\t\t\tfi\n>  \t\t\t\tfi\n>  \t\t\tfi\n\nSomebody should simplify this deeply nested \"if/then/if/then/fi/fi\"\nsequence to a single if/then/fi statement, i.e. something like:\n\n\tif test -n \"${GIT_PS1_SHOWUNTRACKEDFILES-}\" &&\n           test \"$(git config --bool bash.showUntrackedFiles)\" != false\n        then\n\t\tu='%'\n\tfi\n\nAnd do the same for the other one this patch copies the above from.\n\nNo need to re-roll this patch, though.  It is a separate clean-up to\nbe done on top, once this series is settles.\n\nThanks.\n"},{"id":"209478","messageId":"7v621wb2sp.fsf@alter.siamese.dyndns.org","threadId":"32890","inReplyTo":"1360753321-5002-2-git-send-email-martinerikwerner@gmail.com","subject":"Re: [PATCH v2 2/3] t9903: add tests for bash.showUntrackedFiles","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-02-13T16:23:50Z","receivedAt":"2013-02-13T16:23:50Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Martin Erik Werner <martinerikwerner@gmail.com> writes:\n\n> Add 4 test for the bash.showUntrackedFiles config option, covering all\n> combinations of the shell var being set/unset and the config option\n> being enabled/disabled.\n>\n> Signed-off-by: Martin Erik Werner <martinerikwerner@gmail.com>\n> ---\n>  t/t9903-bash-prompt.sh |   40 ++++++++++++++++++++++++++++++++++++++++\n>  1 file changed, 40 insertions(+)\n>\n> diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh\n> index f17c1f8..cb008e2 100755\n> --- a/t/t9903-bash-prompt.sh\n> +++ b/t/t9903-bash-prompt.sh\n> @@ -437,6 +437,46 @@ test_expect_success 'prompt - untracked files status indicator - untracked files\n>  \ttest_cmp expected \"$actual\"\n>  '\n>  \n> +test_expect_success 'prompt - untracked files status indicator - shell variable unset with config disabled' '\n> +\tprintf \" (master)\" > expected &&\n> +\ttest_config bash.showUntrackedFiles false &&\n> +\t(\n> +\t\tunset -v GIT_PS1_SHOWUNTRACKEDFILES &&\n\nWe do not use \"unset -v\" anywhere else in our system.  Shells\nmimicking SysV may choke on it.  A Portable POSIX script can omit\n\"-v\" when unsetting a variable.\n\nAlso \"unset\" can return false when the variable is not set to begin\nwith with some shells.\n\nNeither of these matters for this particular case because we know we\nare running this under bash in non-posix mode.  I however wonder if\nwe can do something to prevent careless coders to copy and paste\nthis piece when updating other tests that are not limited to bash.\nCommenting each and every use of \"unset -v\" does not sound like a\ngood solution and perhaps I am being unnecessarily worried too much.\n"},{"id":"209479","messageId":"7vy5es9o0g.fsf@alter.siamese.dyndns.org","threadId":"32890","inReplyTo":"1360753321-5002-3-git-send-email-martinerikwerner@gmail.com","subject":"Re: [PATCH v2 3/3] t9903: add extra tests for bash.showDirtyState","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-02-13T16:28:31Z","receivedAt":"2013-02-13T16:28:31Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Martin Erik Werner <martinerikwerner@gmail.com> writes:\n\n> Added 3 extra tests for the bash.showDirtyState config option, tests\n> should now cover all combinations of the shell var being set/unset and\n> the config option being enabled/disabled, given a dirty file.\n\nStrictly speaking, you have 6 not 4 combinations (shell variable\nset/unset * config missing/set to false/set to true).  I think these\nadditional tests cover should all 6 because \"config missing\" case\nshould already have had tests before bash.showDirtyState was added.\n\n> * Renamed test 'disabled by config' to 'shell variable set with config\n>   disabled' for consistency\n> ---\n\nSign-off?\n\n>  t/t9903-bash-prompt.sh |   38 +++++++++++++++++++++++++++++++++++++-\n>  1 file changed, 37 insertions(+), 1 deletion(-)\n>\n> diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh\n> index cb008e2..fa81b09 100755\n> --- a/t/t9903-bash-prompt.sh\n> +++ b/t/t9903-bash-prompt.sh\n> @@ -360,12 +360,48 @@ test_expect_success 'prompt - dirty status indicator - before root commit' '\n>  \ttest_cmp expected \"$actual\"\n>  '\n>  \n> -test_expect_success 'prompt - dirty status indicator - disabled by config' '\n> +test_expect_success 'prompt - dirty status indicator - shell variable unset with config disabled' '\n>  \tprintf \" (master)\" > expected &&\n>  \techo \"dirty\" > file &&\n>  \ttest_when_finished \"git reset --hard\" &&\n>  \ttest_config bash.showDirtyState false &&\n>  \t(\n> +\t\tunset -v GIT_PS1_SHOWDIRTYSTATE &&\n> +\t\t__git_ps1 > \"$actual\"\n> +\t) &&\n> +\ttest_cmp expected \"$actual\"\n> +'\n> +\n> +test_expect_success 'prompt - dirty status indicator - shell variable unset with config enabled' '\n> +\tprintf \" (master)\" > expected &&\n> +\techo \"dirty\" > file &&\n> +\ttest_when_finished \"git reset --hard\" &&\n> +\ttest_config bash.showDirtyState true &&\n> +\t(\n> +\t\tunset -v GIT_PS1_SHOWDIRTYSTATE &&\n> +\t\t__git_ps1 > \"$actual\"\n> +\t) &&\n> +\ttest_cmp expected \"$actual\"\n> +'\n> +\n> +test_expect_success 'prompt - dirty status indicator - shell variable set with config disabled' '\n> +\tprintf \" (master)\" > expected &&\n> +\techo \"dirty\" > file &&\n> +\ttest_when_finished \"git reset --hard\" &&\n> +\ttest_config bash.showDirtyState false &&\n> +\t(\n> +\t\tGIT_PS1_SHOWDIRTYSTATE=y &&\n> +\t\t__git_ps1 > \"$actual\"\n> +\t) &&\n> +\ttest_cmp expected \"$actual\"\n> +'\n> +\n> +test_expect_success 'prompt - dirty status indicator - shell variable set with config enabled' '\n> +\tprintf \" (master *)\" > expected &&\n> +\techo \"dirty\" > file &&\n> +\ttest_when_finished \"git reset --hard\" &&\n> +\ttest_config bash.showDirtyState true &&\n> +\t(\n>  \t\tGIT_PS1_SHOWDIRTYSTATE=y &&\n>  \t\t__git_ps1 > \"$actual\"\n>  \t) &&\n"},{"id":"209483","messageId":"1360776461.13768.8.camel@mas","threadId":"32890","inReplyTo":"7v621wb2sp.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v2 2/3] t9903: add tests for bash.showUntrackedFiles","fromName":"Martin Erik Werner","fromEmail":"martinerikwerner@gmail.com","sentAt":"2013-02-13T17:27:41Z","receivedAt":"2013-02-13T17:27:41Z","isPatch":true,"sender":{"key":"martinerikwerner@gmail.com","avatar":"https://avatars.githubusercontent.com/u/732190?v=4"},"body":"On Wed, 2013-02-13 at 08:23 -0800, Junio C Hamano wrote:\n> Martin Erik Werner <martinerikwerner@gmail.com> writes:\n> \n> > Add 4 test for the bash.showUntrackedFiles config option, covering all\n> > combinations of the shell var being set/unset and the config option\n> > being enabled/disabled.\n> >\n> > Signed-off-by: Martin Erik Werner <martinerikwerner@gmail.com>\n> > ---\n> >  t/t9903-bash-prompt.sh |   40 ++++++++++++++++++++++++++++++++++++++++\n> >  1 file changed, 40 insertions(+)\n> >\n> > diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh\n> > index f17c1f8..cb008e2 100755\n> > --- a/t/t9903-bash-prompt.sh\n> > +++ b/t/t9903-bash-prompt.sh\n> > @@ -437,6 +437,46 @@ test_expect_success 'prompt - untracked files status indicator - untracked files\n> >  \ttest_cmp expected \"$actual\"\n> >  '\n> >  \n> > +test_expect_success 'prompt - untracked files status indicator - shell variable unset with config disabled' '\n> > +\tprintf \" (master)\" > expected &&\n> > +\ttest_config bash.showUntrackedFiles false &&\n> > +\t(\n> > +\t\tunset -v GIT_PS1_SHOWUNTRACKEDFILES &&\n> \n> We do not use \"unset -v\" anywhere else in our system.  Shells\n> mimicking SysV may choke on it.  A Portable POSIX script can omit\n> \"-v\" when unsetting a variable.\n> \n> Also \"unset\" can return false when the variable is not set to begin\n> with with some shells.\n> \n> Neither of these matters for this particular case because we know we\n> are running this under bash in non-posix mode.  I however wonder if\n> we can do something to prevent careless coders to copy and paste\n> this piece when updating other tests that are not limited to bash.\n> Commenting each and every use of \"unset -v\" does not sound like a\n> good solution and perhaps I am being unnecessarily worried too much.\n> \n\nYeah, my (ba)sh foo is a bit limited, I was just basing on\nhttp://wiki.bash-hackers.org/commands/builtin/unset#portability_considerations which seemed to recommend using -v.\n\nSo would it make sense to do:\n\tGIT_PS1_SHOWUNTRACKEDFILES=\"dummy\" &&\n\tunset GIT_PS1_SHOWUNTRACKEDFILES &&\n\t(...)\ninstead then?\n\n-- \nMartin Erik Werner <martinerikwerner@gmail.com>\n"},{"id":"209484","messageId":"1360777065.13768.17.camel@mas","threadId":"32890","inReplyTo":"7vy5es9o0g.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v2 3/3] t9903: add extra tests for bash.showDirtyState","fromName":"Martin Erik Werner","fromEmail":"martinerikwerner@gmail.com","sentAt":"2013-02-13T17:37:45Z","receivedAt":"2013-02-13T17:37:45Z","isPatch":true,"sender":{"key":"martinerikwerner@gmail.com","avatar":"https://avatars.githubusercontent.com/u/732190?v=4"},"body":"On Wed, 2013-02-13 at 08:28 -0800, Junio C Hamano wrote:\n> Martin Erik Werner <martinerikwerner@gmail.com> writes:\n> \n> > Added 3 extra tests for the bash.showDirtyState config option, tests\n> > should now cover all combinations of the shell var being set/unset and\n> > the config option being enabled/disabled, given a dirty file.\n> \n> Strictly speaking, you have 6 not 4 combinations (shell variable\n> set/unset * config missing/set to false/set to true).  I think these\n> additional tests cover should all 6 because \"config missing\" case\n> should already have had tests before bash.showDirtyState was added.\n> \n\nIndeed, I only mentioned 4 since the other ones existed already, and I\ndidn't change them, but maybe it should be mentioned as \"combined with\nprevious tests (...) cover all 6 combinations (...)\" then?\n\n> > * Renamed test 'disabled by config' to 'shell variable set with config\n> >   disabled' for consistency\n> > ---\n> \n> Sign-off?\n\nAh, just forgot the -s flag on that commit, yes it should be Signed-off\nby me.\n\n> \n> >  t/t9903-bash-prompt.sh |   38 +++++++++++++++++++++++++++++++++++++-\n> >  1 file changed, 37 insertions(+), 1 deletion(-)\n> >\n> > diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh\n> > index cb008e2..fa81b09 100755\n> > --- a/t/t9903-bash-prompt.sh\n> > +++ b/t/t9903-bash-prompt.sh\n> > @@ -360,12 +360,48 @@ test_expect_success 'prompt - dirty status indicator - before root commit' '\n> >  \ttest_cmp expected \"$actual\"\n> >  '\n> >  \n> > -test_expect_success 'prompt - dirty status indicator - disabled by config' '\n> > +test_expect_success 'prompt - dirty status indicator - shell variable unset with config disabled' '\n> >  \tprintf \" (master)\" > expected &&\n> >  \techo \"dirty\" > file &&\n> >  \ttest_when_finished \"git reset --hard\" &&\n> >  \ttest_config bash.showDirtyState false &&\n> >  \t(\n> > +\t\tunset -v GIT_PS1_SHOWDIRTYSTATE &&\n> > +\t\t__git_ps1 > \"$actual\"\n> > +\t) &&\n> > +\ttest_cmp expected \"$actual\"\n> > +'\n> > +\n> > +test_expect_success 'prompt - dirty status indicator - shell variable unset with config enabled' '\n> > +\tprintf \" (master)\" > expected &&\n> > +\techo \"dirty\" > file &&\n> > +\ttest_when_finished \"git reset --hard\" &&\n> > +\ttest_config bash.showDirtyState true &&\n> > +\t(\n> > +\t\tunset -v GIT_PS1_SHOWDIRTYSTATE &&\n> > +\t\t__git_ps1 > \"$actual\"\n> > +\t) &&\n> > +\ttest_cmp expected \"$actual\"\n> > +'\n> > +\n> > +test_expect_success 'prompt - dirty status indicator - shell variable set with config disabled' '\n> > +\tprintf \" (master)\" > expected &&\n> > +\techo \"dirty\" > file &&\n> > +\ttest_when_finished \"git reset --hard\" &&\n> > +\ttest_config bash.showDirtyState false &&\n> > +\t(\n> > +\t\tGIT_PS1_SHOWDIRTYSTATE=y &&\n> > +\t\t__git_ps1 > \"$actual\"\n> > +\t) &&\n> > +\ttest_cmp expected \"$actual\"\n> > +'\n> > +\n> > +test_expect_success 'prompt - dirty status indicator - shell variable set with config enabled' '\n> > +\tprintf \" (master *)\" > expected &&\n> > +\techo \"dirty\" > file &&\n> > +\ttest_when_finished \"git reset --hard\" &&\n> > +\ttest_config bash.showDirtyState true &&\n> > +\t(\n> >  \t\tGIT_PS1_SHOWDIRTYSTATE=y &&\n> >  \t\t__git_ps1 > \"$actual\"\n> >  \t) &&\n"},{"id":"209488","messageId":"7vr4kk6lhr.fsf@alter.siamese.dyndns.org","threadId":"32890","inReplyTo":"1360776461.13768.8.camel@mas","subject":"Re: [PATCH v2 2/3] t9903: add tests for bash.showUntrackedFiles","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-02-13T19:51:12Z","receivedAt":"2013-02-13T19:51:12Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Martin Erik Werner <martinerikwerner@gmail.com> writes:\n\n> So would it make sense to do:\n> \tGIT_PS1_SHOWUNTRACKEDFILES=\"dummy\" &&\n> \tunset GIT_PS1_SHOWUNTRACKEDFILES &&\n> \t(...)\n> instead then?\n\nI think we have sane_unset exactly for this reason.\n"},{"id":"209489","messageId":"7vmwv86le8.fsf@alter.siamese.dyndns.org","threadId":"32890","inReplyTo":"1360777065.13768.17.camel@mas","subject":"Re: [PATCH v2 3/3] t9903: add extra tests for bash.showDirtyState","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-02-13T19:53:19Z","receivedAt":"2013-02-13T19:53:19Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Martin Erik Werner <martinerikwerner@gmail.com> writes:\n\n>> Strictly speaking, you have 6 not 4 combinations (shell variable\n>> set/unset * config missing/set to false/set to true).  I think these\n>> additional tests cover should all 6 because \"config missing\" case\n>> should already have had tests before bash.showDirtyState was added.\n>> \n>\n> Indeed, I only mentioned 4 since the other ones existed already, and I\n> didn't change them, but maybe it should be mentioned as \"combined with\n> previous tests (...) cover all 6 combinations (...)\" then?\n\nIt should be sufficient to change the third line of your original to\nsay \"the config option being missing/enabled/disabled, given a dirty\nfile.\" and nothing else, I think.\n\n>> Sign-off?\n>\n> Ah, just forgot the -s flag on that commit, yes it should be Signed-off\n> by me.\n\nOK, I'll locally amend the patch.  Thanks.\n"},{"id":"209495","messageId":"1360788036.22870.4.camel@mas","threadId":"32890","inReplyTo":"7vmwv86le8.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v2 3/3] t9903: add extra tests for bash.showDirtyState","fromName":"Martin Erik Werner","fromEmail":"martinerikwerner@gmail.com","sentAt":"2013-02-13T20:40:36Z","receivedAt":"2013-02-13T20:40:36Z","isPatch":true,"sender":{"key":"martinerikwerner@gmail.com","avatar":"https://avatars.githubusercontent.com/u/732190?v=4"},"body":"On Wed, 2013-02-13 at 11:53 -0800, Junio C Hamano wrote:\n> Martin Erik Werner <martinerikwerner@gmail.com> writes:\n> \n> >> Strictly speaking, you have 6 not 4 combinations (shell variable\n> >> set/unset * config missing/set to false/set to true).  I think these\n> >> additional tests cover should all 6 because \"config missing\" case\n> >> should already have had tests before bash.showDirtyState was added.\n> >> \n> >\n> > Indeed, I only mentioned 4 since the other ones existed already, and I\n> > didn't change them, but maybe it should be mentioned as \"combined with\n> > previous tests (...) cover all 6 combinations (...)\" then?\n> \n> It should be sufficient to change the third line of your original to\n> say \"the config option being missing/enabled/disabled, given a dirty\n> file.\" and nothing else, I think.\n> \n> >> Sign-off?\n> >\n> > Ah, just forgot the -s flag on that commit, yes it should be Signed-off\n> > by me.\n> \n> OK, I'll locally amend the patch.  Thanks.\n\nOk, so I shouldn't reroll them with s/unset -v/sane_unset/ and reworded\ncommits + sign-off then, I can if you prefer that?\n\n-- \nMartin Erik Werner <martinerikwerner@gmail.com>\n"},{"id":"209496","messageId":"7vmwv854ji.fsf@alter.siamese.dyndns.org","threadId":"32890","inReplyTo":"1360788036.22870.4.camel@mas","subject":"Re: [PATCH v2 3/3] t9903: add extra tests for bash.showDirtyState","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-02-13T20:42:41Z","receivedAt":"2013-02-13T20:42:41Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Martin Erik Werner <martinerikwerner@gmail.com> writes:\n\n>> OK, I'll locally amend the patch.  Thanks.\n>\n> Ok, so I shouldn't reroll them with s/unset -v/sane_unset/ and reworded\n> commits + sign-off then, I can if you prefer that?\n\nYou can if you wanted to.  That would be less work for me ;-).\n"},{"id":"209497","messageId":"1360789100-26285-1-git-send-email-martinerikwerner@gmail.com","threadId":"32890","inReplyTo":"7vmwv854ji.fsf@alter.siamese.dyndns.org","subject":"[PATCH v3 2/3] t9903: add tests for bash.showUntrackedFiles","fromName":"Martin Erik Werner","fromEmail":"martinerikwerner@gmail.com","sentAt":"2013-02-13T20:58:18Z","receivedAt":"2013-02-13T20:58:18Z","isPatch":true,"sender":{"key":"martinerikwerner@gmail.com","avatar":"https://avatars.githubusercontent.com/u/732190?v=4"},"body":"Add 4 test for the bash.showUntrackedFiles config option, the tests now\ncover all combinations of the shell var being set/unset and the config\noption being missing/enabled/disabled.\n\nSigned-off-by: Martin Erik Werner <martinerikwerner@gmail.com>\n---\n t/t9903-bash-prompt.sh |   40 ++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 40 insertions(+)\n\ndiff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh\nindex f17c1f8..dd9ac6a 100755\n--- a/t/t9903-bash-prompt.sh\n+++ b/t/t9903-bash-prompt.sh\n@@ -437,6 +437,46 @@ test_expect_success 'prompt - untracked files status indicator - untracked files\n \ttest_cmp expected \"$actual\"\n '\n \n+test_expect_success 'prompt - untracked files status indicator - shell variable unset with config disabled' '\n+\tprintf \" (master)\" > expected &&\n+\ttest_config bash.showUntrackedFiles false &&\n+\t(\n+\t\tsane_unset GIT_PS1_SHOWUNTRACKEDFILES &&\n+\t\t__git_ps1 > \"$actual\"\n+\t) &&\n+\ttest_cmp expected \"$actual\"\n+'\n+\n+test_expect_success 'prompt - untracked files status indicator - shell variable unset with config enabled' '\n+\tprintf \" (master)\" > expected &&\n+\ttest_config bash.showUntrackedFiles true &&\n+\t(\n+\t\tsane_unset GIT_PS1_SHOWUNTRACKEDFILES &&\n+\t\t__git_ps1 > \"$actual\"\n+\t) &&\n+\ttest_cmp expected \"$actual\"\n+'\n+\n+test_expect_success 'prompt - untracked files status indicator - shell variable set with config disabled' '\n+\tprintf \" (master)\" > expected &&\n+\ttest_config bash.showUntrackedFiles false &&\n+\t(\n+\t\tGIT_PS1_SHOWUNTRACKEDFILES=y &&\n+\t\t__git_ps1 > \"$actual\"\n+\t) &&\n+\ttest_cmp expected \"$actual\"\n+'\n+\n+test_expect_success 'prompt - untracked files status indicator - shell variable set with config enabled' '\n+\tprintf \" (master %%)\" > expected &&\n+\ttest_config bash.showUntrackedFiles true &&\n+\t(\n+\t\tGIT_PS1_SHOWUNTRACKEDFILES=y &&\n+\t\t__git_ps1 > \"$actual\"\n+\t) &&\n+\ttest_cmp expected \"$actual\"\n+'\n+\n test_expect_success 'prompt - untracked files status indicator - not shown inside .git directory' '\n \tprintf \" (GIT_DIR!)\" > expected &&\n \t(\n-- \n1.7.10.4\n"},{"id":"209498","messageId":"1360789100-26285-2-git-send-email-martinerikwerner@gmail.com","threadId":"32890","inReplyTo":"1360789100-26285-1-git-send-email-martinerikwerner@gmail.com","subject":"[PATCH v3 3/3] t9903: add extra tests for bash.showDirtyState","fromName":"Martin Erik Werner","fromEmail":"martinerikwerner@gmail.com","sentAt":"2013-02-13T20:58:19Z","receivedAt":"2013-02-13T20:58:19Z","isPatch":true,"sender":{"key":"martinerikwerner@gmail.com","avatar":"https://avatars.githubusercontent.com/u/732190?v=4"},"body":"Add 3 extra tests for the bash.showDirtyState config option, the test\nnow cover all combinations of the shell var being set/unset and the\nconfig option being missing/enabled/disabled, given a dirty file.\n\n* Renamed test 'disabled by config' to 'shell variable set with config\n  disabled' for consistency\n\nSigned-off-by: Martin Erik Werner <martinerikwerner@gmail.com>\n---\n t/t9903-bash-prompt.sh |   38 +++++++++++++++++++++++++++++++++++++-\n 1 file changed, 37 insertions(+), 1 deletion(-)\n\ndiff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh\nindex dd9ac6a..2101d91 100755\n--- a/t/t9903-bash-prompt.sh\n+++ b/t/t9903-bash-prompt.sh\n@@ -360,12 +360,48 @@ test_expect_success 'prompt - dirty status indicator - before root commit' '\n \ttest_cmp expected \"$actual\"\n '\n \n-test_expect_success 'prompt - dirty status indicator - disabled by config' '\n+test_expect_success 'prompt - dirty status indicator - shell variable unset with config disabled' '\n \tprintf \" (master)\" > expected &&\n \techo \"dirty\" > file &&\n \ttest_when_finished \"git reset --hard\" &&\n \ttest_config bash.showDirtyState false &&\n \t(\n+\t\tsane_unset GIT_PS1_SHOWDIRTYSTATE &&\n+\t\t__git_ps1 > \"$actual\"\n+\t) &&\n+\ttest_cmp expected \"$actual\"\n+'\n+\n+test_expect_success 'prompt - dirty status indicator - shell variable unset with config enabled' '\n+\tprintf \" (master)\" > expected &&\n+\techo \"dirty\" > file &&\n+\ttest_when_finished \"git reset --hard\" &&\n+\ttest_config bash.showDirtyState true &&\n+\t(\n+\t\tsane_unset GIT_PS1_SHOWDIRTYSTATE &&\n+\t\t__git_ps1 > \"$actual\"\n+\t) &&\n+\ttest_cmp expected \"$actual\"\n+'\n+\n+test_expect_success 'prompt - dirty status indicator - shell variable set with config disabled' '\n+\tprintf \" (master)\" > expected &&\n+\techo \"dirty\" > file &&\n+\ttest_when_finished \"git reset --hard\" &&\n+\ttest_config bash.showDirtyState false &&\n+\t(\n+\t\tGIT_PS1_SHOWDIRTYSTATE=y &&\n+\t\t__git_ps1 > \"$actual\"\n+\t) &&\n+\ttest_cmp expected \"$actual\"\n+'\n+\n+test_expect_success 'prompt - dirty status indicator - shell variable set with config enabled' '\n+\tprintf \" (master *)\" > expected &&\n+\techo \"dirty\" > file &&\n+\ttest_when_finished \"git reset --hard\" &&\n+\ttest_config bash.showDirtyState true &&\n+\t(\n \t\tGIT_PS1_SHOWDIRTYSTATE=y &&\n \t\t__git_ps1 > \"$actual\"\n \t) &&\n-- \n1.7.10.4\n"}]}