Mercurial > dotfiles
comparison .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 |
comparison
equal
deleted
inserted
replaced
261:a5ec16bba8a9 | 262:3350b219b653 |
---|---|
140 local root=`hg root 2> /dev/null` | 140 local root=`hg root 2> /dev/null` |
141 if [ x$root != 'x' ] ; then | 141 if [ x$root != 'x' ] ; then |
142 cd $root | 142 cd $root |
143 return 0 | 143 return 0 |
144 fi | 144 fi |
145 git branch 2> /dev/null > /dev/null | 145 root=$(git rev-parse --show-toplevel 2> /dev/null) |
146 if [ $? = 0 ] ; then | 146 if [ $? = 0 ] ; then |
147 while [ ! -e .git ] ; do | 147 cd $root |
148 cd .. | |
149 done | |
150 return 0 | 148 return 0 |
151 fi | 149 fi |
152 if [ -e .svn ] ; then | 150 if [ -e .svn ] ; then |
153 while [ -e ../.svn ] ; do | 151 while [ -e ../.svn ] ; do |
154 cd .. | 152 cd .. |