Fix status in bare repository

This commit is contained in:
Tim Pope
2021-04-13 07:50:13 -04:00
parent d4e8c29084
commit 503c22f1f5

View File

@@ -1853,7 +1853,11 @@ function! fugitive#BufReadStatus() abort
let [staged, unstaged, untracked] = [[], [], []] let [staged, unstaged, untracked] = [[], [], []]
let props = {} let props = {}
if fugitive#GitVersion(2, 11) let pull = ''
if empty(s:Tree())
let branch = FugitiveHead(0)
let head = FugitiveHead(11)
elseif fugitive#GitVersion(2, 11)
let cmd += ['status', '--porcelain=v2', '-bz'] let cmd += ['status', '--porcelain=v2', '-bz']
let [output, message, exec_error] = s:NullError(cmd) let [output, message, exec_error] = s:NullError(cmd)
if exec_error if exec_error
@@ -1912,7 +1916,6 @@ function! fugitive#BufReadStatus() abort
call remove(output, 0) call remove(output, 0)
endwhile endwhile
let head = matchstr(output[0], '^## \zs\S\+\ze\%($\| \[\)') let head = matchstr(output[0], '^## \zs\S\+\ze\%($\| \[\)')
let pull = ''
if head =~# '\.\.\.' if head =~# '\.\.\.'
let [head, pull] = split(head, '\.\.\.') let [head, pull] = split(head, '\.\.\.')
let branch = head let branch = head
@@ -1947,10 +1950,6 @@ function! fugitive#BufReadStatus() abort
endwhile endwhile
endif endif
if empty(s:Tree())
let [unstaged, untracked] = [[], []]
endif
for dict in staged for dict in staged
let b:fugitive_files['Staged'][dict.filename] = dict let b:fugitive_files['Staged'][dict.filename] = dict
endfor endfor