aboutsummaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-08-29 14:55:12 -0700
committerJunio C Hamano <gitster@pobox.com>2022-08-29 14:55:12 -0700
commita572a5d4c1a00f276b4b6ed4e86cdb3d9aed51dc (patch)
tree07d6910329ff0ea169a3ed606a17248159e5ede5 /contrib
parentMerge branch 'vd/scalar-enables-fsmonitor' (diff)
parentgit-prompt: show presence of unresolved conflicts at command prompt (diff)
downloadgit-a572a5d4c1a00f276b4b6ed4e86cdb3d9aed51dc.tar.gz
git-a572a5d4c1a00f276b4b6ed4e86cdb3d9aed51dc.zip
Merge branch 'jd/prompt-show-conflict'
The bash prompt (in contrib/) learned to optionally indicate when the index is unmerged. * jd/prompt-show-conflict: git-prompt: show presence of unresolved conflicts at command prompt
Diffstat (limited to 'contrib')
-rw-r--r--contrib/completion/git-prompt.sh12
1 files changed, 11 insertions, 1 deletions
diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh
index 1435548e00..57972c2845 100644
--- a/contrib/completion/git-prompt.sh
+++ b/contrib/completion/git-prompt.sh
@@ -84,6 +84,10 @@
# single '?' character by setting GIT_PS1_COMPRESSSPARSESTATE, or omitted
# by setting GIT_PS1_OMITSPARSESTATE.
#
+# If you would like to see a notification on the prompt when there are
+# unresolved conflicts, set GIT_PS1_SHOWCONFLICTSTATE to "yes". The
+# prompt will include "|CONFLICT".
+#
# If you would like to see more information about the identity of
# commits checked out as a detached HEAD, set GIT_PS1_DESCRIBE_STYLE
# to one of these values:
@@ -508,6 +512,12 @@ __git_ps1 ()
r="$r $step/$total"
fi
+ local conflict="" # state indicator for unresolved conflicts
+ if [[ "${GIT_PS1_SHOWCONFLICTSTATE}" == "yes" ]] &&
+ [[ $(git ls-files --unmerged 2>/dev/null) ]]; then
+ conflict="|CONFLICT"
+ fi
+
local w=""
local i=""
local s=""
@@ -572,7 +582,7 @@ __git_ps1 ()
fi
local f="$h$w$i$s$u$p"
- local gitstring="$c$b${f:+$z$f}${sparse}$r${upstream}"
+ local gitstring="$c$b${f:+$z$f}${sparse}$r${upstream}${conflict}"
if [ $pcmode = yes ]; then
if [ "${__git_printf_supports_v-}" != yes ]; then