diff options
Diffstat (limited to 't/t9903-bash-prompt.sh')
-rwxr-xr-x | t/t9903-bash-prompt.sh | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh index ab890d3d4b..ab5da2cabc 100755 --- a/t/t9903-bash-prompt.sh +++ b/t/t9903-bash-prompt.sh @@ -163,7 +163,7 @@ test_expect_success 'prompt - inside bare repository' ' ' test_expect_success 'prompt - interactive rebase' ' - printf " (b1|REBASE-i 2/3)" >expected && + printf " (b1|REBASE 2/3)" >expected && write_script fake_editor.sh <<-\EOF && echo "exec echo" >"$1" echo "edit $(git log -1 --format="%h")" >>"$1" @@ -180,7 +180,7 @@ test_expect_success 'prompt - interactive rebase' ' ' test_expect_success 'prompt - rebase merge' ' - printf " (b2|REBASE-m 1/3)" >expected && + printf " (b2|REBASE 1/3)" >expected && git checkout b2 && test_when_finished "git checkout master" && test_must_fail git rebase --merge b1 b2 && @@ -189,11 +189,11 @@ test_expect_success 'prompt - rebase merge' ' test_cmp expected "$actual" ' -test_expect_success 'prompt - rebase' ' +test_expect_success 'prompt - rebase am' ' printf " (b2|REBASE 1/3)" >expected && git checkout b2 && test_when_finished "git checkout master" && - test_must_fail git rebase b1 b2 && + test_must_fail git rebase --apply b1 b2 && test_when_finished "git rebase --abort" && __git_ps1 >"$actual" && test_cmp expected "$actual" @@ -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" ' @@ -513,10 +529,9 @@ test_expect_success 'prompt - format string starting with dash' ' test_expect_success 'prompt - pc mode' ' printf "BEFORE: (\${__git_ps1_branch_name}):AFTER\\nmaster" >expected && - printf "" >expected_output && ( __git_ps1 "BEFORE:" ":AFTER" >"$actual" && - test_cmp expected_output "$actual" && + test_must_be_empty "$actual" && printf "%s\\n%s" "$PS1" "${__git_ps1_branch_name}" >"$actual" ) && test_cmp expected "$actual" @@ -712,13 +727,12 @@ test_expect_success 'prompt - hide if pwd ignored - env var set, config disabled ' test_expect_success 'prompt - hide if pwd ignored - env var set, config unset' ' - printf "" >expected && ( cd ignored_dir && GIT_PS1_HIDE_IF_PWD_IGNORED=y && __git_ps1 >"$actual" ) && - test_cmp expected "$actual" + test_must_be_empty "$actual" ' test_expect_success 'prompt - hide if pwd ignored - env var set, config unset, pc mode' ' |