|
2 | 2 | " Filename: autoload/gitbranch.vim
|
3 | 3 | " Author: itchyny
|
4 | 4 | " License: MIT License
|
5 | | -" Last Change: 2015/02/01 23:49:33. |
| 5 | +" Last Change: 2015/02/20 21:00:53. |
6 | 6 | " =============================================================================
|
7 | 7 |
|
8 | 8 | let s:save_cpo = &cpo
|
@@ -31,6 +31,11 @@ function! gitbranch#dir(path) abort
|
31 | 31 | let type = getftype(dir)
|
32 | 32 | if type ==# 'dir' && isdirectory(dir.'/objects') && isdirectory(dir.'/refs') && getfsize(dir.'/HEAD') > 10
|
33 | 33 | return dir
|
| 34 | + elseif type ==# 'file' |
| 35 | + let reldir = get(readfile(dir), 0, '') |
| 36 | + if reldir =~# '^gitdir: ' |
| 37 | + return simplify(path . '/' . reldir[8:]) |
| 38 | + endif |
34 | 39 | endif
|
35 | 40 | let prev = path
|
36 | 41 | let path = fnamemodify(path, ':h')
|
|
0 commit comments