[zsh]add crootgit

This commit is contained in:
Mathieu Maret 2016-05-23 14:56:35 +02:00
parent 3cef108dc7
commit fad6baa93e

View File

@ -129,7 +129,7 @@ sepgrep() {
gettop () gettop ()
{ {
local TOPFILE=build/core/envsetup.mk; local TOPFILE=$1;
if [ -n "$TOP" -a -f "$TOP/$TOPFILE" ]; then if [ -n "$TOP" -a -f "$TOP/$TOPFILE" ]; then
echo $TOP; echo $TOP;
else else
@ -150,11 +150,23 @@ gettop ()
fi fi
} }
crootgit ()
{
local TOPFILE=.git/config;
T=$(gettop $TOPFILE);
if [ "$T" ]; then
\cd $(gettop $TOPFILE);
else
echo "Couldn't locate the top of the tree. Try setting TOP.";
fi
}
croot () croot ()
{ {
T=$(gettop); local TOPFILE=build/core/envsetup.mk;
T=$(gettop $TOPFILE);
if [ "$T" ]; then if [ "$T" ]; then
\cd $(gettop); \cd $(gettop $TOPFILE);
else else
echo "Couldn't locate the top of the tree. Try setting TOP."; echo "Couldn't locate the top of the tree. Try setting TOP.";
fi fi