From: Junio C Hamano <hidden> Date: 2016-06-15 22:56:09
Martin Erik Werner [off-list ref] writes:
quoted hunk
Add a test case for the bash.showUntrackedFiles config option, which
checks that the config option can disable the global effect of the
GIT_PS1_SHOWUNTRACKEDFILES environmant variable.
Signed-off-by: Martin Erik Werner <redacted>
---
t/t9903-bash-prompt.sh | 11 +++++++++++
1 file changed, 11 insertions(+)
@@ -447,6 +447,17 @@ test_expect_success 'prompt - untracked files status indicator - not shown insidtest_cmpexpected"$actual"'+test_expect_success'prompt - untracked files status indicator - disabled by config''+printf" (master)">expected&&+echo"untracked">file_untracked&&+test_configbash.showUntrackedFilesfalse&&+(+GIT_PS1_SHOWUNTRACKEDFILES=y&&+__git_ps1>"$actual"+)&&+test_cmpexpected"$actual"+'
All six combinations need checking:
* not having the configuration at all and not having the shell
variable should not show the untracked indicator (already tested).
* not having the configuration at all and having the shell variable
should show the untracked indicator (already tested).
* setting configuration to true without having the shell variable
should not show the untracked indicator.
* setting configuration to true and having the shell variable
should show the unttracked indicator.
* setting configuration to false and having the shell variable
should not show the untracked indicator (the above test checks
this).
* setting configuration to false without having the shell variable
should not show the untracked indicator.
to prevent others from breaking the code you wrote for [PATCH 1/2],
so you need three more tests, I guess?
From: Martin Erik Werner <hidden> Date: 2016-06-15 22:56:09
On Tue, 2013-02-12 at 14:29 -0800, Junio C Hamano wrote:
Martin Erik Werner [off-list ref] writes:
quoted
Add a test case for the bash.showUntrackedFiles config option, which
checks that the config option can disable the global effect of the
GIT_PS1_SHOWUNTRACKEDFILES environmant variable.
Signed-off-by: Martin Erik Werner <redacted>
---
t/t9903-bash-prompt.sh | 11 +++++++++++
1 file changed, 11 insertions(+)
@@ -447,6 +447,17 @@ test_expect_success 'prompt - untracked files status indicator - not shown insidtest_cmpexpected"$actual"'+test_expect_success'prompt - untracked files status indicator - disabled by config''+printf" (master)">expected&&+echo"untracked">file_untracked&&+test_configbash.showUntrackedFilesfalse&&+(+GIT_PS1_SHOWUNTRACKEDFILES=y&&+__git_ps1>"$actual"+)&&+test_cmpexpected"$actual"+'
All six combinations need checking:
* not having the configuration at all and not having the shell
variable should not show the untracked indicator (already tested).
* not having the configuration at all and having the shell variable
should show the untracked indicator (already tested).
* setting configuration to true without having the shell variable
should not show the untracked indicator.
* setting configuration to true and having the shell variable
should show the unttracked indicator.
* setting configuration to false and having the shell variable
should not show the untracked indicator (the above test checks
this).
* setting configuration to false without having the shell variable
should not show the untracked indicator.
to prevent others from breaking the code you wrote for [PATCH 1/2],
so you need three more tests, I guess?
Ah, yes, I was mimicing what the test did for bash.showDirtyState, I've
now added the three extra tests for bash.showUntrackedFiles, which
should cover all of the above cases, hopefully?
I've also added in the three extra tests for bash.showDirtyState,
equivalently. These only cover the case of dirty files and not
combinations with content in index, which I felt was a bit overkill, is
that reasonable?
Thanks for the review :)
--
Martin Erik Werner [off-list ref]
From: Martin Erik Werner <hidden> Date: 2016-06-15 22:56:09
Add a config option 'bash.showUntrackedFiles' which allows enabling
the prompt showing untracked files on a per-repository basis. This is
useful for some repositories where the 'git ls-files ...' command may
take a long time.
Signed-off-by: Martin Erik Werner <redacted>
---
contrib/completion/git-prompt.sh | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
@@ -43,7 +43,10 @@## If you would like to see if there're untracked files, then you can set# GIT_PS1_SHOWUNTRACKEDFILES to a nonempty value. If there're untracked-# files, then a '%' will be shown next to the branch name.+# files, then a '%' will be shown next to the branch name. You can+# configure this per-repository with the bash.showUntrackedFiles+# variable, which defaults to true once GIT_PS1_SHOWUNTRACKEDFILES is+# enabled.## If you would like to see the difference between HEAD and its upstream,# set GIT_PS1_SHOWUPSTREAM="auto". A "<" indicates you are behind, ">"
From: Martin Erik Werner <hidden> Date: 2016-06-15 22:56:09
Add 4 test for the bash.showUntrackedFiles config option, covering all
combinations of the shell var being set/unset and the config option
being enabled/disabled.
Signed-off-by: Martin Erik Werner <redacted>
---
t/t9903-bash-prompt.sh | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
From: Martin Erik Werner <hidden> Date: 2016-06-15 22:56:09
Added 3 extra tests for the bash.showDirtyState config option, tests
should now cover all combinations of the shell var being set/unset and
the config option being enabled/disabled, given a dirty file.
* Renamed test 'disabled by config' to 'shell variable set with config
disabled' for consistency
---
t/t9903-bash-prompt.sh | 38 +++++++++++++++++++++++++++++++++++++-
1 file changed, 37 insertions(+), 1 deletion(-)