chore: fix nested git repos

This commit is contained in:
2022-02-18 14:12:52 +01:00
parent e4939853d6
commit 8720d0e19b
2 changed files with 12 additions and 14 deletions

View File

@ -29,8 +29,7 @@ end
# Git
function git::is_repo
test -d .git; or command git rev-parse --git-dir 2>/dev/null 2>/dev/null
# test 0 -eq 1
test -d .git; or command git rev-parse --git-dir >/dev/null 2>/dev/null
end
function git::ahead -a ahead behind diverged none
@ -89,22 +88,21 @@ end
function fish_right_prompt
if test "$theme_complete_path" = "yes"
set cwd (prompt_pwd)
else
set cwd (basename (prompt_pwd))
# if test "$theme_complete_path" = "yes"
# set cwd (prompt_pwd)
# else
# set cwd (basename (prompt_pwd))
if git::is_repo
set root_folder (command git rev-parse --show-toplevel 2>/dev/null)
set parent_root_folder (dirname $root_folder)
set cwd (echo $PWD | sed -e "s|$parent_root_folder/||")
end
end
# if git::is_repo
# set root_folder (command git rev-parse --show-toplevel 2>/dev/null)
# set parent_root_folder (dirname $root_folder)
# set cwd (echo $PWD | sed -e "s|$parent_root_folder/||")
# end
# end
# Because of having a two line promt now we dont need right anymore so we dont print anything here atm
#printf (yellow)"("(off)$cwd(yellow)") "(off)
#printf (off)(date +%H(yellow):(off)%M(yellow):(off)%S)(off)"\n"
end