From 3c084f57bbd0bbab9f091cf94f0b4fb6a5846c9c Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sun, 6 May 2012 13:40:11 -0400 Subject: [PATCH] [#169] Move _git-dir out of git-info into git-dir --- modules/git/functions/git-dir | 16 ++++++++++++++++ modules/git/functions/git-info | 16 ++-------------- 2 files changed, 18 insertions(+), 14 deletions(-) create mode 100644 modules/git/functions/git-dir diff --git a/modules/git/functions/git-dir b/modules/git/functions/git-dir new file mode 100644 index 0000000..a52e6c2 --- /dev/null +++ b/modules/git/functions/git-dir @@ -0,0 +1,16 @@ +# +# Gets the path to the Git directory. +# +# Authors: +# Sorin Ionescu +# + +local git_dir="${$(git rev-parse --git-dir):A}" + +if [[ -n "$git_dir" ]]; then + print "$git_dir" + return 0 +fi + +return 1 + diff --git a/modules/git/functions/git-info b/modules/git/functions/git-info index 26b38fd..87f3a86 100644 --- a/modules/git/functions/git-info +++ b/modules/git/functions/git-info @@ -67,24 +67,12 @@ # Load dependencies. omodload 'trap' -# Gets the path to the Git directory. -function _git-dir { - local git_dir="${$(git rev-parse --git-dir):A}" - - if [[ -n "$git_dir" ]]; then - print "$git_dir" - return 0 - fi - - return 1 -} - # Gets the Git special action (am, merge, rebase, etc.). # Borrowed from vcs_info and edited. function _git-action { local action='' local action_dir - local git_dir="$(_git-dir)" + local git_dir="$(git-dir)" for action_dir in \ "${git_dir}/rebase-apply" \ @@ -279,7 +267,7 @@ function git-info { fi # Format stashed. - if [[ -f "$(_git-dir)/refs/stash" ]]; then + if [[ -f "$(git-dir)/refs/stash" ]]; then stashed="$(git stash list 2> /dev/null | wc -l)" zstyle -s ':omz:module:git' stashed 'stashed_format' zformat -f stashed_formatted "$stashed_format" "S:$stashed"