summaryrefslogtreecommitdiff
path: root/t/t9903-bash-prompt.sh
diff options
context:
space:
mode:
authorPhillip Wood <phillip.wood@dunelm.org.uk>2019-07-01 14:21:06 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-07-01 19:39:44 (GMT)
commite981bf75251ecab712fa70ea2fe995a973ed5dba (patch)
tree075d190e229475bbb7a38a675382d18084a9a80b /t/t9903-bash-prompt.sh
parent8dca754b1e874719a732bc9ab7b0e14b21b1bc10 (diff)
downloadgit-e981bf75251ecab712fa70ea2fe995a973ed5dba.zip
git-e981bf75251ecab712fa70ea2fe995a973ed5dba.tar.gz
git-e981bf75251ecab712fa70ea2fe995a973ed5dba.tar.bz2
git-prompt: improve cherry-pick/revert detection
If the user commits or resets a conflict resolution in the middle of a sequence of cherry-picks or reverts then CHERRY_PICK_HEAD/REVERT_HEAD will be removed and so in the absence of those files we need to check .git/sequencer/todo to see if there is a cherry-pick or revert in progress. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t9903-bash-prompt.sh')
-rwxr-xr-xt/t9903-bash-prompt.sh20
1 files changed, 18 insertions, 2 deletions
diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh
index 5cadedb..88bc733 100755
--- a/t/t9903-bash-prompt.sh
+++ b/t/t9903-bash-prompt.sh
@@ -211,8 +211,24 @@ test_expect_success 'prompt - merge' '
test_expect_success 'prompt - cherry-pick' '
printf " (master|CHERRY-PICKING)" >expected &&
- test_must_fail git cherry-pick b1 &&
- test_when_finished "git reset --hard" &&
+ test_must_fail git cherry-pick b1 b1^ &&
+ test_when_finished "git cherry-pick --abort" &&
+ __git_ps1 >"$actual" &&
+ test_cmp expected "$actual" &&
+ git reset --merge &&
+ test_must_fail git rev-parse CHERRY_PICK_HEAD &&
+ __git_ps1 >"$actual" &&
+ test_cmp expected "$actual"
+'
+
+test_expect_success 'prompt - revert' '
+ printf " (master|REVERTING)" >expected &&
+ test_must_fail git revert b1^ b1 &&
+ test_when_finished "git revert --abort" &&
+ __git_ps1 >"$actual" &&
+ test_cmp expected "$actual" &&
+ git reset --merge &&
+ test_must_fail git rev-parse REVERT_HEAD &&
__git_ps1 >"$actual" &&
test_cmp expected "$actual"
'