From 5b0d6744de116f6a644f1b208261d72c8094ab01 Mon Sep 17 00:00:00 2001 From: Jonathan Schleifer Date: Thu, 28 May 2020 23:17:45 +0000 Subject: [PATCH] Prefer Fossil branch over Git branch in prompt --- fish/functions/fish_prompt.fish | 6 +++--- zshrc | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fish/functions/fish_prompt.fish b/fish/functions/fish_prompt.fish index 2582688..12e3d8c 100644 --- a/fish/functions/fish_prompt.fish +++ b/fish/functions/fish_prompt.fish @@ -7,11 +7,11 @@ function fish_prompt --description 'Write out the prompt' set suffix '>' end - set -l branch (git symbolic-ref HEAD 2>/dev/null) - set branch (string replace -r "^refs/heads/" "" $branch) + set -l branch (fossil branch current 2>/dev/null) if test -z "$branch" - set branch (fossil branch current 2>/dev/null) + set branch (git symbolic-ref HEAD 2>/dev/null) + set branch (string replace -r "^refs/heads/" "" $branch) end set -l vcs diff --git a/zshrc b/zshrc index 5d45276..81af5d5 100644 --- a/zshrc +++ b/zshrc @@ -103,11 +103,11 @@ set_prompt __precmd() { __update_terminal_cwd - local branch=$(git symbolic-ref HEAD 2>/dev/null) - branch=${branch##refs/heads/} + local branch=$(fossil branch current 2>/dev/null) if [ -z "$branch" ]; then - branch=$(fossil branch current 2>/dev/null) + branch=$(git symbolic-ref HEAD 2>/dev/null) + branch=${branch##refs/heads/} fi set_prompt $branch