mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-12 13:23:52 -05:00
Return full ref name on FugitiveHead(-1)
This commit is contained in:
@@ -925,11 +925,15 @@ function! fugitive#Head(...) abort
|
||||
let s:head_cache[file] = [ftime, readfile(file)[0]]
|
||||
endif
|
||||
let head = s:head_cache[file][1]
|
||||
let len = a:0 ? a:1 : 0
|
||||
if head =~# '^ref: '
|
||||
return substitute(head, '\C^ref: \%(refs/\%(heads/\|remotes/\|tags/\)\=\)\=', '', '')
|
||||
if len < 0
|
||||
return strpart(head, 5)
|
||||
else
|
||||
return substitute(head, '\C^ref: \%(refs/\%(heads/\|remotes/\|tags/\)\=\)\=', '', '')
|
||||
endif
|
||||
elseif head =~# '^\x\{40,\}$'
|
||||
let len = a:0 ? a:1 : 0
|
||||
return len < 0 ? head : len ? head[0:len-1] : ''
|
||||
return len < 0 ? head : strpart(head, 0, len)
|
||||
else
|
||||
return ''
|
||||
endif
|
||||
|
||||
Reference in New Issue
Block a user