summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSZEDER Gábor <szeder@ira.uka.de>2015-07-19 13:28:05 +0200
committerJunio C Hamano <gitster@pobox.com>2015-07-20 13:08:53 -0700
commit6bfab998b5046e8f4f7b0ae4833ba4babf92de83 (patch)
treef08c8fedd27c68bdb5249f87053cbb2ad8be7ae2
parentbb3e7b1a5505bae590b0d85a3995a61d6dd82547 (diff)
downloadgit-6bfab998b5046e8f4f7b0ae4833ba4babf92de83.tar.gz
bash prompt: test untracked files status indicator with untracked dirs
The next commit will tweak the way __git_ps1() decides whether to display the untracked files status indicator in the presence of untracked directories. Add tests to make sure it doesn't change current behavior, in particular that an empty untracked directory doesn't trigger the untracked files status indicator. Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-xt/t9903-bash-prompt.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh
index 49d58e6726..6b68777b98 100755
--- a/t/t9903-bash-prompt.sh
+++ b/t/t9903-bash-prompt.sh
@@ -397,6 +397,31 @@ test_expect_success 'prompt - untracked files status indicator - untracked files
test_cmp expected "$actual"
'
+test_expect_success 'prompt - untracked files status indicator - empty untracked dir' '
+ printf " (master)" >expected &&
+ mkdir otherrepo/untracked-dir &&
+ test_when_finished "rm -rf otherrepo/untracked-dir" &&
+ (
+ GIT_PS1_SHOWUNTRACKEDFILES=y &&
+ cd otherrepo &&
+ __git_ps1 >"$actual"
+ ) &&
+ test_cmp expected "$actual"
+'
+
+test_expect_success 'prompt - untracked files status indicator - non-empty untracked dir' '
+ printf " (master %%)" >expected &&
+ mkdir otherrepo/untracked-dir &&
+ test_when_finished "rm -rf otherrepo/untracked-dir" &&
+ >otherrepo/untracked-dir/untracked-file &&
+ (
+ GIT_PS1_SHOWUNTRACKEDFILES=y &&
+ cd otherrepo &&
+ __git_ps1 >"$actual"
+ ) &&
+ test_cmp expected "$actual"
+'
+
test_expect_success 'prompt - untracked files status indicator - untracked files outside cwd' '
printf " (master %%)" >expected &&
(