1
1
Fork 0

zshrc: Show git and fossil branch at the same time

This commit is contained in:
Jonathan Schleifer 2020-05-24 00:13:55 +00:00
parent 9ebbecb974
commit 73598ec4ba

14
zshrc
View file

@ -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