commit 196e44837555e0e05080e6bc9dfc5605a06eaabb (tree)
parent e0b770a9bde9bd0084006fabca5b53e6591e3360
Author: Tim Pope <code@tpope.net>
Date: Sun, 22 Jul 2018 14:10:21 -0400
Make :Gmove always relative to repository root
Diffstat:
2 files changed, 3 insertions(+), 12 deletions(-)
diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim
@@ -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
diff --git a/doc/fugitive.txt b/doc/fugitive.txt
@@ -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