[#169] Move _git-dir out of git-info into git-dir

This commit is contained in:
Sorin Ionescu 2012-05-06 13:40:11 -04:00
parent 3efd4b22c1
commit 3c084f57bb
2 changed files with 18 additions and 14 deletions

View File

@ -0,0 +1,16 @@
#
# Gets the path to the Git directory.
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
local git_dir="${$(git rev-parse --git-dir):A}"
if [[ -n "$git_dir" ]]; then
print "$git_dir"
return 0
fi
return 1

View File

@ -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"