Make :Gmove always relative to repository root
This commit is contained in:
parent
e0b770a9bd
commit
196e448375
@ -2066,10 +2066,7 @@ function! s:Move(force, rename, destination) abort
|
||||
elseif a:rename
|
||||
let destination = fnamemodify(s:Relative(''), ':h') . '/' . a:destination
|
||||
else
|
||||
let destination = s:shellslash(fnamemodify(s:sub(a:destination,'[%#]%(:\w)*','\=expand(submatch(0))'),':p'))
|
||||
if destination[0:strlen(s:repo().tree())] ==# s:repo().tree('')
|
||||
let destination = destination[strlen(s:repo().tree('')):-1]
|
||||
endif
|
||||
let destination = a:destination
|
||||
endif
|
||||
if isdirectory(s:buffer().spec())
|
||||
setlocal noswapfile
|
||||
@ -2099,9 +2096,7 @@ function! s:MoveComplete(A,L,P) abort
|
||||
if a:A =~# '^/'
|
||||
return s:repo().superglob(a:A)
|
||||
else
|
||||
let matches = split(glob(a:A.'*'),"\n")
|
||||
call map(matches,'v:val !~# "/$" && isdirectory(v:val) ? v:val."/" : v:val')
|
||||
return matches
|
||||
return map(s:repo().superglob('/' . a:A), 'strpart(v:val, 1)')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
@ -199,11 +199,7 @@ that are part of Git repositories).
|
||||
|
||||
*fugitive-:Gmove*
|
||||
:Gmove {destination} Wrapper around git-mv that renames the buffer
|
||||
afterward. The destination is relative to the current
|
||||
directory except when started with a /, in which case
|
||||
it is relative to the work tree. (This is a holdover
|
||||
from before |:Grename| and will be removed.) Add a !
|
||||
to pass -f.
|
||||
afterward. Add a ! to pass -f.
|
||||
|
||||
*fugitive-:Grename*
|
||||
:Grename {destination} Like |:Gmove| but operates relative to the parent
|
||||
|
Loading…
Reference in New Issue
Block a user