Support submodules on 1.7.10

In 1.7.10, the git-file switched from using an absolute to a relative
path.  Treat any path starting with "." as relative.  (A more robust
check for a relative path is more complicated than looking for a leading
slash because of Windows.)

Closes #201.
This commit is contained in:
Tim Pope 2012-05-15 21:50:13 -04:00
parent 476fbd0950
commit a8d450fcfe

View File

@ -119,7 +119,9 @@ function! fugitive#extract_git_dir(path) abort
return resolve(dir)
elseif type !=# '' && filereadable(dir)
let line = get(readfile(dir, '', 1), 0, '')
if line =~# '^gitdir: ' && fugitive#is_git_dir(line[8:-1])
if line =~# '^gitdir: \.' && fugitive#is_git_dir(root.'/'.line[8:-1])
return simplify(root.'/'.line[8:-1])
elseif line =~# '^gitdir: ' && fugitive#is_git_dir(line[8:-1])
return line[8:-1]
endif
elseif fugitive#is_git_dir(root)