From 73598ec4baa6187493bf1c90e176d206543168d0 Mon Sep 17 00:00:00 2001 From: Jonathan Schleifer Date: Sun, 24 May 2020 00:13:55 +0000 Subject: [PATCH] zshrc: Show git and fossil branch at the same time --- zshrc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/zshrc b/zshrc index 36a9f6a..83900e8 100644 --- a/zshrc +++ b/zshrc @@ -99,11 +99,17 @@ set_prompt __precmd() { __update_terminal_cwd - local branch=$(fossil branch current 2>/dev/null) + local branch="" + local fossil_branch=$(fossil branch current 2>/dev/null) + if [ -n "$fossil_branch" ]; then + branch="$branch${branch:+ }f:$fossil_branch" + fi - if [ -z "$branch" ]; then - branch=$(git symbolic-ref HEAD 2>/dev/null) - branch=${branch##refs/heads/} + + local git_branch=$(git symbolic-ref HEAD 2>/dev/null) + git_branch=${git_branch##refs/heads/} + if [ -n "$git_branch" ]; then + branch="$branch${branch:+ }g:$git_branch" fi set_prompt $branch