Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Donnelly <justinrdonnelly@gmail.com>2022-08-17 03:18:12 +0300
committerJunio C Hamano <gitster@pobox.com>2022-08-19 20:58:40 +0300
commite03acd0d4ad75115f454041fac3300ae796f108f (patch)
tree7ef09758c5d933c967f776a10d6ba8014d229963 /t/t9903-bash-prompt.sh
parent795ea8776befc95ea2becd8020c7a284677b4161 (diff)
git-prompt: show presence of unresolved conflicts at command prompt
If GIT_PS1_SHOWCONFLICTSTATE is set to "yes", show the word "CONFLICT" on the command prompt when there are unresolved conflicts. Example prompt: (main|CONFLICT) Signed-off-by: Justin Donnelly <justinrdonnelly@gmail.com> Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t9903-bash-prompt.sh')
-rwxr-xr-xt/t9903-bash-prompt.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh
index 6a30f5719c..d459fae655 100755
--- a/t/t9903-bash-prompt.sh
+++ b/t/t9903-bash-prompt.sh
@@ -759,4 +759,20 @@ test_expect_success 'prompt - hide if pwd ignored - inside gitdir' '
test_cmp expected "$actual"
'
+test_expect_success 'prompt - conflict indicator' '
+ printf " (main|CONFLICT)" >expected &&
+ echo "stash" >file &&
+ git stash &&
+ test_when_finished "git stash drop" &&
+ echo "commit" >file &&
+ git commit -m "commit" file &&
+ test_when_finished "git reset --hard HEAD~" &&
+ test_must_fail git stash apply &&
+ (
+ GIT_PS1_SHOWCONFLICTSTATE="yes" &&
+ __git_ps1 >"$actual"
+ ) &&
+ test_cmp expected "$actual"
+'
+
test_done