|
|
|
@ -1,7 +1,9 @@
|
|
|
|
|
# git helper functions
|
|
|
|
|
# unused
|
|
|
|
|
function __git_is_repo -d "Test if the current directory is a Git repository"
|
|
|
|
|
if not command git rev-parse --git-dir > /dev/null 2>/dev/null
|
|
|
|
|
# don't consider the .git dir as part of the repo
|
|
|
|
|
# so we use --show-toplevel (which fails inside .git) instead of --git-dir
|
|
|
|
|
if not command git rev-parse --show-toplevel > /dev/null 2>/dev/null
|
|
|
|
|
return 1
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
@ -140,6 +142,7 @@ function fish_prompt
|
|
|
|
|
segment $base_color " $pwd_info[3] "
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if __git_is_repo
|
|
|
|
|
if set branch_name (__git_branch_name)
|
|
|
|
|
|
|
|
|
|
if __git_is_stashed
|
|
|
|
@ -193,6 +196,7 @@ function fish_prompt
|
|
|
|
|
end
|
|
|
|
|
segment "$git_color[1]" "$git_color[2]" "$prompt"
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
segment $base_color " $dir"(set_color $text_color)"$base "
|
|
|
|
|
|
|
|
|
|