1
1
Fork 0

Prefer Fossil branch over Git branch in prompt

This commit is contained in:
Jonathan Schleifer 2020-05-28 23:17:45 +00:00
parent 1c7c719fa5
commit 5b0d6744de
2 changed files with 6 additions and 6 deletions

View file

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

6
zshrc
View file

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