From 4c91a709472a9965d0d8f93ca829eb7347a056a4 Mon Sep 17 00:00:00 2001 From: Pavel Puchkin Date: Sat, 27 Apr 2013 00:47:14 -0300 Subject: [PATCH] Add git_get_root function which returns root of current repo --- lib/git.zsh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/git.zsh b/lib/git.zsh index 96598cf5f..cd1bff034 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -5,6 +5,10 @@ function git_prompt_info() { echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX" } +# returns root of current repo +function git_get_root() { + echo "$(git rev-parse --show-toplevel 2> /dev/null)" +} # Checks if working tree is dirty parse_git_dirty() {