From fad6baa93eea28e869b4ae13f15c7be1e3c2a646 Mon Sep 17 00:00:00 2001 From: Mathieu Maret Date: Mon, 23 May 2016 14:56:35 +0200 Subject: [PATCH] [zsh]add crootgit --- .zsh/40_function.zsh | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/.zsh/40_function.zsh b/.zsh/40_function.zsh index 0e24aff..41a6d17 100755 --- a/.zsh/40_function.zsh +++ b/.zsh/40_function.zsh @@ -129,7 +129,7 @@ sepgrep() { gettop () { - local TOPFILE=build/core/envsetup.mk; + local TOPFILE=$1; if [ -n "$TOP" -a -f "$TOP/$TOPFILE" ]; then echo $TOP; else @@ -150,11 +150,23 @@ gettop () 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 () { - T=$(gettop); + local TOPFILE=build/core/envsetup.mk; + T=$(gettop $TOPFILE); if [ "$T" ]; then - \cd $(gettop); + \cd $(gettop $TOPFILE); else echo "Couldn't locate the top of the tree. Try setting TOP."; fi