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>

SZEDER Gábor committed Jul 19, 2015 at 13:28 UTC 6bfab998b5046e8f4f7b0ae4833ba4babf92de83
1 file changed +25
t/t9903-bash-prompt.sh
+25
@@ -397,6 +397,31 @@ test_expect_success 'prompt - untracked files status indicator - untracked files
397 test_cmp expected "$actual"
398 '
399
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 +
425 test_expect_success 'prompt - untracked files status indicator - untracked files outside cwd' '
426 printf " (master %%)" >expected &&
427 (