mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-12 21:33:53 -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]]
|
let s:head_cache[file] = [ftime, readfile(file)[0]]
|
||||||
endif
|
endif
|
||||||
let head = s:head_cache[file][1]
|
let head = s:head_cache[file][1]
|
||||||
if head =~# '^ref: '
|
|
||||||
return substitute(head, '\C^ref: \%(refs/\%(heads/\|remotes/\|tags/\)\=\)\=', '', '')
|
|
||||||
elseif head =~# '^\x\{40,\}$'
|
|
||||||
let len = a:0 ? a:1 : 0
|
let len = a:0 ? a:1 : 0
|
||||||
return len < 0 ? head : len ? head[0:len-1] : ''
|
if head =~# '^ref: '
|
||||||
|
if len < 0
|
||||||
|
return strpart(head, 5)
|
||||||
|
else
|
||||||
|
return substitute(head, '\C^ref: \%(refs/\%(heads/\|remotes/\|tags/\)\=\)\=', '', '')
|
||||||
|
endif
|
||||||
|
elseif head =~# '^\x\{40,\}$'
|
||||||
|
return len < 0 ? head : strpart(head, 0, len)
|
||||||
else
|
else
|
||||||
return ''
|
return ''
|
||||||
endif
|
endif
|
||||||
|
|||||||
Reference in New Issue
Block a user