summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-12-04 19:19:12 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-12-04 19:19:12 (GMT)
commit80c17cac368c8acf47d5b79b4f5e40d4018efa42 (patch)
tree894b02474453dd67b3f03ba667afdeb72c35f69d /t
parent3a5b6eeceb8ea149ec8c0139f64683942e62722b (diff)
parentc26f70ceb3960603a78010c87f8ad11820ab6561 (diff)
downloadgit-80c17cac368c8acf47d5b79b4f5e40d4018efa42.zip
git-80c17cac368c8acf47d5b79b4f5e40d4018efa42.tar.gz
git-80c17cac368c8acf47d5b79b4f5e40d4018efa42.tar.bz2
Merge branch 'sg/bash-prompt-dirty-orphan'
Produce correct "dirty" marker for shell prompts, even when we are on an orphan or an unborn branch. * sg/bash-prompt-dirty-orphan: bash prompt: indicate dirty index even on orphan branches bash prompt: remove a redundant 'git diff' option bash prompt: test dirty index and worktree while on an orphan branch
Diffstat (limited to 't')
-rwxr-xr-xt/t9903-bash-prompt.sh31
1 files changed, 28 insertions, 3 deletions
diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh
index 6b68777..af82049 100755
--- a/t/t9903-bash-prompt.sh
+++ b/t/t9903-bash-prompt.sh
@@ -273,11 +273,36 @@ test_expect_success 'prompt - dirty status indicator - dirty index and worktree'
test_cmp expected "$actual"
'
-test_expect_success 'prompt - dirty status indicator - before root commit' '
- printf " (master #)" >expected &&
+test_expect_success 'prompt - dirty status indicator - orphan branch - clean' '
+ printf " (orphan #)" >expected &&
+ test_when_finished "git checkout master" &&
+ git checkout --orphan orphan &&
+ git reset --hard &&
+ (
+ GIT_PS1_SHOWDIRTYSTATE=y &&
+ __git_ps1 >"$actual"
+ ) &&
+ test_cmp expected "$actual"
+'
+
+test_expect_success 'prompt - dirty status indicator - orphan branch - dirty index' '
+ printf " (orphan +)" >expected &&
+ test_when_finished "git checkout master" &&
+ git checkout --orphan orphan &&
+ (
+ GIT_PS1_SHOWDIRTYSTATE=y &&
+ __git_ps1 >"$actual"
+ ) &&
+ test_cmp expected "$actual"
+'
+
+test_expect_success 'prompt - dirty status indicator - orphan branch - dirty index and worktree' '
+ printf " (orphan *+)" >expected &&
+ test_when_finished "git checkout master" &&
+ git checkout --orphan orphan &&
+ >file &&
(
GIT_PS1_SHOWDIRTYSTATE=y &&
- cd otherrepo &&
__git_ps1 >"$actual"
) &&
test_cmp expected "$actual"