# HG changeset patch # User Augie Fackler # Date 1308321977 18000 # Node ID 3350b219b65340f36c1151da4a909f4754d372ce # Parent a5ec16bba8a956ea228a2bb60e749de75b5aebb4 wcroot: use git to directly find repo root. git cleverly hides this under git-rev-parse, which isn't a place I'd have ever thought to look. Thanks to Jacob Lee for the tip. diff --git a/.shell.d/50.vcs_functions.sh b/.shell.d/50.vcs_functions.sh --- a/.shell.d/50.vcs_functions.sh +++ b/.shell.d/50.vcs_functions.sh @@ -142,11 +142,9 @@ function wcroot() { cd $root return 0 fi - git branch 2> /dev/null > /dev/null + root=$(git rev-parse --show-toplevel 2> /dev/null) if [ $? = 0 ] ; then - while [ ! -e .git ] ; do - cd .. - done + cd $root return 0 fi if [ -e .svn ] ; then