Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 8dc9134

Browse files
committed
fix git directory detection inside /.git/modules/ (fix #8)
1 parent 8118dc1 commit 8dc9134

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

‎autoload/gitbranch.vim

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
" Filename: autoload/gitbranch.vim
33
" Author: itchyny
44
" License: MIT License
5-
" Last Change: 2015年02月26日 00:34:03.
5+
" Last Change: 2021年08月20日 23:05:12.
66
" =============================================================================
77

88
let s:save_cpo = &cpo
@@ -26,6 +26,7 @@ endfunction
2626
function! gitbranch#dir(path) abort
2727
let path = a:path
2828
let prev = ''
29+
let git_modules = path =~# '/\.git/modules/'
2930
while path !=# prev
3031
let dir = path . '/.git'
3132
let type = getftype(dir)
@@ -36,6 +37,8 @@ function! gitbranch#dir(path) abort
3637
if reldir =~# '^gitdir: '
3738
return simplify(path . '/' . reldir[8:])
3839
endif
40+
elseif git_modules && isdirectory(path.'/objects') && isdirectory(path.'/refs') && getfsize(path.'/HEAD') > 10
41+
return path
3942
endif
4043
let prev = path
4144
let path = fnamemodify(path, ':h')

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /