mirror of
https://github.com/lowne/fish-prompt-metro.git
synced 2024-10-27 20:34:12 +00:00
don't show git status inside .git
dir
This commit is contained in:
parent
c774c260d0
commit
99ea7d3425
@ -1,7 +1,9 @@
|
|||||||
# git helper functions
|
# git helper functions
|
||||||
# unused
|
# unused
|
||||||
function __git_is_repo -d "Test if the current directory is a Git repository"
|
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
|
return 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -140,6 +142,7 @@ function fish_prompt
|
|||||||
segment $base_color " $pwd_info[3] "
|
segment $base_color " $pwd_info[3] "
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if __git_is_repo
|
||||||
if set branch_name (__git_branch_name)
|
if set branch_name (__git_branch_name)
|
||||||
|
|
||||||
if __git_is_stashed
|
if __git_is_stashed
|
||||||
@ -193,6 +196,7 @@ function fish_prompt
|
|||||||
end
|
end
|
||||||
segment "$git_color[1]" "$git_color[2]" "$prompt"
|
segment "$git_color[1]" "$git_color[2]" "$prompt"
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
segment $base_color " $dir"(set_color $text_color)"$base "
|
segment $base_color " $dir"(set_color $text_color)"$base "
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user