Skip to content

Commit 6bfab99

Browse files
szedergitster
authored andcommitted
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>
1 parent bb3e7b1 commit 6bfab99

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

t/t9903-bash-prompt.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,31 @@ test_expect_success 'prompt - untracked files status indicator - untracked files
397397
test_cmp expected "$actual"
398398
'
399399

400+
test_expect_success 'prompt - untracked files status indicator - empty untracked dir' '
401+
printf " (master)" >expected &&
402+
mkdir otherrepo/untracked-dir &&
403+
test_when_finished "rm -rf otherrepo/untracked-dir" &&
404+
(
405+
GIT_PS1_SHOWUNTRACKEDFILES=y &&
406+
cd otherrepo &&
407+
__git_ps1 >"$actual"
408+
) &&
409+
test_cmp expected "$actual"
410+
'
411+
412+
test_expect_success 'prompt - untracked files status indicator - non-empty untracked dir' '
413+
printf " (master %%)" >expected &&
414+
mkdir otherrepo/untracked-dir &&
415+
test_when_finished "rm -rf otherrepo/untracked-dir" &&
416+
>otherrepo/untracked-dir/untracked-file &&
417+
(
418+
GIT_PS1_SHOWUNTRACKEDFILES=y &&
419+
cd otherrepo &&
420+
__git_ps1 >"$actual"
421+
) &&
422+
test_cmp expected "$actual"
423+
'
424+
400425
test_expect_success 'prompt - untracked files status indicator - untracked files outside cwd' '
401426
printf " (master %%)" >expected &&
402427
(

0 commit comments

Comments
 (0)