Support :(top) pseudo-pathspecs
This commit is contained in:
parent
08d471056e
commit
4bf7f2fd69
@ -359,8 +359,8 @@ function! s:repo_translate(object, ...) dict abort
|
|||||||
else
|
else
|
||||||
let f = dir . f
|
let f = dir . f
|
||||||
endif
|
endif
|
||||||
elseif rev ==# '^/\=\.$'
|
elseif rev =~# '^/\.$\|^:/$'
|
||||||
return base
|
let f = base
|
||||||
elseif rev =~# '^\.\=\%(/\|$\)'
|
elseif rev =~# '^\.\=\%(/\|$\)'
|
||||||
let f = base . substitute(rev, '^\.', '', '')
|
let f = base . substitute(rev, '^\.', '', '')
|
||||||
elseif rev =~# '^:[0-3]:/\@!'
|
elseif rev =~# '^:[0-3]:/\@!'
|
||||||
@ -371,6 +371,8 @@ function! s:repo_translate(object, ...) dict abort
|
|||||||
else
|
else
|
||||||
let f = dir . '/index'
|
let f = dir . '/index'
|
||||||
endif
|
endif
|
||||||
|
elseif rev =~# '^:(\%(top\|top,literal\|literal,top\|literal\))'
|
||||||
|
let f = base . '/' . matchstr(rev, ')\zs.*')
|
||||||
elseif rev =~# '^:/\@!'
|
elseif rev =~# '^:/\@!'
|
||||||
let f = 'fugitive://' . dir . '//0/' . rev[1:-1]
|
let f = 'fugitive://' . dir . '//0/' . rev[1:-1]
|
||||||
else
|
else
|
||||||
@ -971,7 +973,7 @@ endfunction
|
|||||||
function! fugitive#PathComplete(base, ...) abort
|
function! fugitive#PathComplete(base, ...) abort
|
||||||
let dir = a:0 == 1 ? a:1 : get(b:, 'git_dir', '')
|
let dir = a:0 == 1 ? a:1 : get(b:, 'git_dir', '')
|
||||||
let tree = FugitiveTreeForGitDir(dir) . '/'
|
let tree = FugitiveTreeForGitDir(dir) . '/'
|
||||||
let strip = '^:\=/\%(\./\)\='
|
let strip = '^\%(:\=/\|:(top)\|:(top,literal)\|:(literal,top)\|:(literal)\)\%(\./\)\='
|
||||||
let base = substitute(a:base, strip, '', '')
|
let base = substitute(a:base, strip, '', '')
|
||||||
if base =~# '^\.git/'
|
if base =~# '^\.git/'
|
||||||
let pattern = s:gsub(base[5:-1], '/', '*&').'*'
|
let pattern = s:gsub(base[5:-1], '/', '*&').'*'
|
||||||
@ -994,11 +996,11 @@ endfunction
|
|||||||
function! fugitive#Complete(base, ...) abort
|
function! fugitive#Complete(base, ...) abort
|
||||||
let dir = a:0 == 1 ? a:1 : get(b:, 'git_dir', '')
|
let dir = a:0 == 1 ? a:1 : get(b:, 'git_dir', '')
|
||||||
let tree = s:Tree(dir) . '/'
|
let tree = s:Tree(dir) . '/'
|
||||||
if a:base =~# '^\.\=/' || a:base !~# ':'
|
if a:base =~# '^\.\=/\|^:(' || a:base !~# ':'
|
||||||
let results = []
|
let results = []
|
||||||
if a:base =~# '^refs/'
|
if a:base =~# '^refs/'
|
||||||
let results += map(s:GlobComplete(fugitive#CommonDir(dir) . '/', a:base . '*'), 's:Slash(v:val)')
|
let results += map(s:GlobComplete(fugitive#CommonDir(dir) . '/', a:base . '*'), 's:Slash(v:val)')
|
||||||
elseif a:base !~# '^\.\=/'
|
elseif a:base !~# '^\.\=/\|^:('
|
||||||
let heads = ['HEAD', 'ORIG_HEAD', 'FETCH_HEAD', 'MERGE_HEAD', 'refs/']
|
let heads = ['HEAD', 'ORIG_HEAD', 'FETCH_HEAD', 'MERGE_HEAD', 'refs/']
|
||||||
let heads += sort(split(s:TreeChomp(["rev-parse","--symbolic","--branches","--tags","--remotes"], dir),"\n"))
|
let heads += sort(split(s:TreeChomp(["rev-parse","--symbolic","--branches","--tags","--remotes"], dir),"\n"))
|
||||||
if filereadable(fugitive#CommonDir(dir) . '/refs/stash')
|
if filereadable(fugitive#CommonDir(dir) . '/refs/stash')
|
||||||
@ -2632,6 +2634,8 @@ endfunction
|
|||||||
function! s:Move(force, rename, destination) abort
|
function! s:Move(force, rename, destination) abort
|
||||||
if a:destination =~# '^[.:]\=/'
|
if a:destination =~# '^[.:]\=/'
|
||||||
let destination = substitute(a:destination[1:-1], '^[.:]\=/', '', '')
|
let destination = substitute(a:destination[1:-1], '^[.:]\=/', '', '')
|
||||||
|
elseif a:destination =~# '^:(\%(top\|top,literal\|literal,top\|literal\))'
|
||||||
|
let destination = matchstr(a:destination, ')\zs.*')
|
||||||
elseif a:rename
|
elseif a:rename
|
||||||
let destination = fnamemodify(s:Relative(''), ':h') . '/' . a:destination
|
let destination = fnamemodify(s:Relative(''), ':h') . '/' . a:destination
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user