@@ -360,7 +360,31 @@ test_expect_success 'prompt - dirty status indicator - before root commit' '
360360test_cmp expected "$actual"
361361'
362362
363- test_expect_success ' prompt - dirty status indicator - disabled by config' '
363+ test_expect_success ' prompt - dirty status indicator - shell variable unset with config disabled' '
364+ printf " (master)" > expected &&
365+ echo "dirty" > file &&
366+ test_when_finished "git reset --hard" &&
367+ test_config bash.showDirtyState false &&
368+ (
369+ sane_unset GIT_PS1_SHOWDIRTYSTATE &&
370+ __git_ps1 > "$actual"
371+ ) &&
372+ test_cmp expected "$actual"
373+ '
374+
375+ test_expect_success ' prompt - dirty status indicator - shell variable unset with config enabled' '
376+ printf " (master)" > expected &&
377+ echo "dirty" > file &&
378+ test_when_finished "git reset --hard" &&
379+ test_config bash.showDirtyState true &&
380+ (
381+ sane_unset GIT_PS1_SHOWDIRTYSTATE &&
382+ __git_ps1 > "$actual"
383+ ) &&
384+ test_cmp expected "$actual"
385+ '
386+
387+ test_expect_success ' prompt - dirty status indicator - shell variable set with config disabled' '
364388printf " (master)" > expected &&
365389echo "dirty" > file &&
366390test_when_finished "git reset --hard" &&
@@ -372,6 +396,18 @@ test_expect_success 'prompt - dirty status indicator - disabled by config' '
372396test_cmp expected "$actual"
373397'
374398
399+ test_expect_success ' prompt - dirty status indicator - shell variable set with config enabled' '
400+ printf " (master *)" > expected &&
401+ echo "dirty" > file &&
402+ test_when_finished "git reset --hard" &&
403+ test_config bash.showDirtyState true &&
404+ (
405+ GIT_PS1_SHOWDIRTYSTATE=y &&
406+ __git_ps1 > "$actual"
407+ ) &&
408+ test_cmp expected "$actual"
409+ '
410+
375411test_expect_success ' prompt - dirty status indicator - not shown inside .git directory' '
376412printf " (GIT_DIR!)" > expected &&
377413echo "dirty" > file &&
@@ -437,6 +473,46 @@ test_expect_success 'prompt - untracked files status indicator - untracked files
437473test_cmp expected "$actual"
438474'
439475
476+ test_expect_success ' prompt - untracked files status indicator - shell variable unset with config disabled' '
477+ printf " (master)" > expected &&
478+ test_config bash.showUntrackedFiles false &&
479+ (
480+ sane_unset GIT_PS1_SHOWUNTRACKEDFILES &&
481+ __git_ps1 > "$actual"
482+ ) &&
483+ test_cmp expected "$actual"
484+ '
485+
486+ test_expect_success ' prompt - untracked files status indicator - shell variable unset with config enabled' '
487+ printf " (master)" > expected &&
488+ test_config bash.showUntrackedFiles true &&
489+ (
490+ sane_unset GIT_PS1_SHOWUNTRACKEDFILES &&
491+ __git_ps1 > "$actual"
492+ ) &&
493+ test_cmp expected "$actual"
494+ '
495+
496+ test_expect_success ' prompt - untracked files status indicator - shell variable set with config disabled' '
497+ printf " (master)" > expected &&
498+ test_config bash.showUntrackedFiles false &&
499+ (
500+ GIT_PS1_SHOWUNTRACKEDFILES=y &&
501+ __git_ps1 > "$actual"
502+ ) &&
503+ test_cmp expected "$actual"
504+ '
505+
506+ test_expect_success ' prompt - untracked files status indicator - shell variable set with config enabled' '
507+ printf " (master %%)" > expected &&
508+ test_config bash.showUntrackedFiles true &&
509+ (
510+ GIT_PS1_SHOWUNTRACKEDFILES=y &&
511+ __git_ps1 > "$actual"
512+ ) &&
513+ test_cmp expected "$actual"
514+ '
515+
440516test_expect_success ' prompt - untracked files status indicator - not shown inside .git directory' '
441517printf " (GIT_DIR!)" > expected &&
442518(
0 commit comments