From 83a047a8a3da5d63ea665e4042cd7c522cd2a4e2 Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Wed, 29 Jul 2020 17:21:26 +0100 Subject: [PATCH] Adds conflicts to git prompt config --- shells/zsh/includes/promptconfig.zsh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/shells/zsh/includes/promptconfig.zsh b/shells/zsh/includes/promptconfig.zsh index ba96671b..a17f4491 100644 --- a/shells/zsh/includes/promptconfig.zsh +++ b/shells/zsh/includes/promptconfig.zsh @@ -120,23 +120,29 @@ prompt_git(){ [ -n "$branch" ] && ret=" $branch " [ -n "$tag" ] && ret+=" $tag " [ -n "$ret" ] || ret="$(git rev-parse --short HEAD 2> /dev/null)" - local repoTopLevel="$(command git rev-parse --show-toplevel 2> /dev/null)" local untrackedFiles=$(command git ls-files --others --exclude-standard "${repoTopLevel}" 2> /dev/null) local modified=$(command git diff --name-only 2> /dev/null) local staged=$(command git diff --staged --name-only 2> /dev/null) + local conflicts=$(command git status --porcelain | grep -E '^(.?U|DD|AA)') + local tokens if [ -n "$untrackedFiles" ]; then - ret+=" " + tokens+=" " color="orange1" fi if [ -n "$modified" ]; then - ret+=" " + tokens+=" " color="orange1" fi if [ -n "$staged" ]; then - ret+=" " + tokens+=" " color="orange1" fi + if [ -n "$conflicts" ]; then + tokens=" " + color="red1" + fi + ret+="$tokens" fi ret="$(echo "$ret" | sed -e 's/ *$//')" echo "$ret"