X-Git-Url: https://defaria.com/gitweb/?a=blobdiff_plain;f=rc%2Ffunctions;h=c27274bfca82f05808d094b91ced22095fea0175;hb=4ab7fa4b0f356e5c0dce0f7cceb4b9152fb85350;hp=1f1636d501402ef59a2ebf22cdcf86337c62b676;hpb=e2b2e80344ea9444b2fba5eaf1c345a2427ca620;p=clearscm.git diff --git a/rc/functions b/rc/functions index 1f1636d..c27274b 100644 --- a/rc/functions +++ b/rc/functions @@ -17,6 +17,21 @@ CR=$(echo "\015") view_name= +function in_git_repo { + pwd=$PWD + + while [ "$pwd" != "/" ]; do + if [ -d "$pwd/.git" ]; then + true; + return; + fi + + pwd=$(dirname $pwd) + done + + false +} # in_git_repo + # Function to set the title bar. Works on the terminal emulators listed. function title_bar { prefix="$@" @@ -39,7 +54,7 @@ function title_bar { fi # Add GIT info if available - if [ -d .git ]; then + if in_git_repo; then current_dir="git: $(git branch | sed -n -e 's/^\* \(.*\)/\1/p') $current_dir" fi @@ -189,7 +204,7 @@ function ssh { } # ssh function sj { - if [ $ARCH = "FreeBSD" ]; then + if [ $ARCHITECTURE = "FreeBSD" ]; then psopts="-aux" else psopts="-ef"