Skip to content

Commit

Permalink
Fix git dir detection for submodules
Browse files Browse the repository at this point in the history
  • Loading branch information
tpope committed Mar 15, 2012
1 parent 0bd010f commit bcb13db
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ftplugin/git.vim
Expand Up @@ -9,7 +9,9 @@ endif
let b:did_ftplugin = 1

if !exists('b:git_dir')
if expand('%:p') =~# '\.git\>'
if expand('%:p') =~# '[\/]\.git[\/]modules[\/][^\/]'
let b:git_dir = matchstr(expand('%:p'),'.*[\/]\.git[\/]modules[\/][^\/]*')
elseif expand('%:p') =~# '\.git\>'
let b:git_dir = matchstr(expand('%:p'),'.*\.git\>')
elseif $GIT_DIR != ''
let b:git_dir = $GIT_DIR
Expand Down

0 comments on commit bcb13db

Please sign in to comment.