Mercurial > dotfiles
changeset 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 (2011-06-17) |
parents | a5ec16bba8a9 |
children | 14f08dbdba1b 8109c1d949c8 |
files | .shell.d/50.vcs_functions.sh |
diffstat | 1 files changed, 2 insertions(+), 4 deletions(-) [+] |
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