Browse Source

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

master
Sorin Ionescu 13 years ago
parent
commit
3c084f57bb
  1. 16
      modules/git/functions/git-dir
  2. 16
      modules/git/functions/git-info

16
modules/git/functions/git-dir

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

16
modules/git/functions/git-info

@ -67,24 +67,12 @@
# Load dependencies. # Load dependencies.
omodload 'trap' 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.). # Gets the Git special action (am, merge, rebase, etc.).
# Borrowed from vcs_info and edited. # Borrowed from vcs_info and edited.
function _git-action { function _git-action {
local action='' local action=''
local action_dir local action_dir
local git_dir="$(_git-dir)" local git_dir="$(git-dir)"
for action_dir in \ for action_dir in \
"${git_dir}/rebase-apply" \ "${git_dir}/rebase-apply" \
@ -279,7 +267,7 @@ function git-info {
fi fi
# Format stashed. # 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)" stashed="$(git stash list 2> /dev/null | wc -l)"
zstyle -s ':omz:module:git' stashed 'stashed_format' zstyle -s ':omz:module:git' stashed 'stashed_format'
zformat -f stashed_formatted "$stashed_format" "S:$stashed" zformat -f stashed_formatted "$stashed_format" "S:$stashed"

Loading…
Cancel
Save