From 9cfb1394bf373ea351f7c2f269db63a2770db6f9 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Thu, 6 Dec 2018 16:15:11 +0100 Subject: [PATCH] sample_prompts/sorin: Add a safe way to determine merge status Based on what __fish_git_prompt is doing. See #5388. [ci skip] --- share/tools/web_config/sample_prompts/sorin.fish | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/share/tools/web_config/sample_prompts/sorin.fish b/share/tools/web_config/sample_prompts/sorin.fish index 8f6c67cb1..69fff2d14 100644 --- a/share/tools/web_config/sample_prompts/sorin.fish +++ b/share/tools/web_config/sample_prompts/sorin.fish @@ -16,7 +16,7 @@ function fish_right_prompt test $status != 0 and printf (set_color red)"⏎ " - if git rev-parse 2>/dev/null + if set -l git_dir (git rev-parse --git-dir 2>/dev/null) # Magenta if branch detached else green set -l branch (command git branch -qv | string match "\**") string match -rq detached -- $branch @@ -25,6 +25,11 @@ function fish_right_prompt git name-rev --name-only HEAD + # Merging state + test -f "$git_dir/MERGE_HEAD" + and printf ':'(set_color red)'merge' + printf ' ' + # Symbols if set -l count (command git rev-list --count --left-right $upstream...HEAD 2>/dev/null) echo $count | read -l ahead behind