Fix :GRename ../

Closes https://github.com/tpope/vim-fugitive/issues/1481
This commit is contained in:
Tim Pope
2020-03-02 02:37:44 -05:00
parent 9acced1409
commit d102dd92fd

View File

@@ -4986,9 +4986,7 @@ function! s:Move(force, rename, destination) abort
if s:DirCommitFile(@%)[1] !~# '^0\=$' || empty(@%) if s:DirCommitFile(@%)[1] !~# '^0\=$' || empty(@%)
return 'echoerr ' . string('fugitive: mv not supported for this buffer') return 'echoerr ' . string('fugitive: mv not supported for this buffer')
endif endif
if a:destination =~# '^\.\.\=\%(/\|$\)' if a:destination =~# '^\a\+:\|^/'
let destination = simplify(getcwd() . '/' . a:destination)
elseif a:destination =~# '^\a\+:\|^/'
let destination = a:destination let destination = a:destination
elseif a:destination =~# '^:/:\=' elseif a:destination =~# '^:/:\='
let destination = s:Tree(dir) . substitute(a:destination, '^:/:\=', '', '') let destination = s:Tree(dir) . substitute(a:destination, '^:/:\=', '', '')
@@ -4997,7 +4995,9 @@ function! s:Move(force, rename, destination) abort
elseif a:destination =~# '^:(literal)' elseif a:destination =~# '^:(literal)'
let destination = simplify(getcwd() . '/' . matchstr(a:destination, ')\zs.*')) let destination = simplify(getcwd() . '/' . matchstr(a:destination, ')\zs.*'))
elseif a:rename elseif a:rename
let destination = expand('%:p:s?[\/]$??:h') . '/' . a:destination let destination = simplify(expand('%:p:s?[\/]$??:h') . '/' . a:destination)
elseif a:destination =~# '^\.\.\=\%(/\|$\)'
let destination = simplify(getcwd() . '/' . a:destination)
else else
let destination = s:Tree(dir) . '/' . a:destination let destination = s:Tree(dir) . '/' . a:destination
endif endif