Browse Source

Use git-rev-parse to get the git directory path

master
Colin Hebert 12 years ago committed by Sorin Ionescu
parent
commit
c435dca233
  1. 16
      plugins/git/functions/git-info

16
plugins/git/functions/git-info

@ -7,21 +7,9 @@ @@ -7,21 +7,9 @@
# Gets the path to the Git directory.
function _git-dir {
local git_root="$(git-root)"
local git_dir_or_file="${git_root}/.git"
local git_dir
local git_dir="${$(git rev-parse --git-dir):A}"
if [[ ! -d "$git_root" ]]; then
return 1
fi
if [[ -f "$git_dir_or_file" ]]; then
git_dir="${${${$(<"$git_dir_or_file")}[(fr)gitdir:*]}#gitdir: }"
else
git_dir="$git_dir_or_file"
fi
if [[ -d "$git_dir" ]]; then
if [[ -n "$git_dir" ]]; then
print "$git_dir"
return 0
fi

Loading…
Cancel
Save