From ab9d28353b84282f414a55101c2c990d816fe894 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20K=C3=B6rber?= Date: Wed, 17 Oct 2018 11:02:17 +0200 Subject: [PATCH] Fixup gb() function --- zsh/zshrc.d/20_aliases.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/zsh/zshrc.d/20_aliases.sh b/zsh/zshrc.d/20_aliases.sh index e705fd8..c4919cc 100644 --- a/zsh/zshrc.d/20_aliases.sh +++ b/zsh/zshrc.d/20_aliases.sh @@ -281,7 +281,10 @@ clip() { } gb() { - while [[ ! -e ./.git ]] ; do - cd .. - done + _superproject="$(git rev-parse --show-superproject-working-tree)" + if [[ -n "${_superproject}" ]] ; then + builtin cd "${_superproject}" + else + builtin cd "$(git rev-parse --show-toplevel)" + fi }