From 8720d0e19beb59b95b069b9c1da37775746a5742 Mon Sep 17 00:00:00 2001 From: T31M Date: Fri, 18 Feb 2022 14:12:52 +0100 Subject: [PATCH] chore: fix nested git repos --- fish/theme-t31m/functions/fish_prompt.fish | 24 +++++++++---------- .../functions/t31m_prompt_right.fish | 2 +- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/fish/theme-t31m/functions/fish_prompt.fish b/fish/theme-t31m/functions/fish_prompt.fish index e111a12..d870271 100644 --- a/fish/theme-t31m/functions/fish_prompt.fish +++ b/fish/theme-t31m/functions/fish_prompt.fish @@ -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 diff --git a/fish/theme-t31m/functions/t31m_prompt_right.fish b/fish/theme-t31m/functions/t31m_prompt_right.fish index 8a1c1c4..eaaef40 100644 --- a/fish/theme-t31m/functions/t31m_prompt_right.fish +++ b/fish/theme-t31m/functions/t31m_prompt_right.fish @@ -7,7 +7,7 @@ function t31m_prompt_right set cwd (basename (prompt_pwd)) if git::is_repo - set root_folder (command git rev-parse --show-toplevel 2>/dev/null) + 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