Mercurial > dotfiles
diff .shell.d/50.vcs_functions.sh @ 262:3350b219b653
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.
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Fri, 17 Jun 2011 09:46:17 -0500 |
parents | b14e669b98bf |
children | 533bde18976e |
line wrap: on
line diff
--- 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