mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-12-10 05:51:58 +08:00
Eliminate last temporary :cd
The new git_chomp and git_chomp_in_tree aren't 100% backwards compatible, but these functions are deprecated anyways. Use system(FugitivePrepare(...)) instead.
This commit is contained in:
@@ -116,19 +116,6 @@ function! s:cpath(path, ...) abort
|
|||||||
return a:0 ? path ==# s:cpath(a:1) : path
|
return a:0 ? path ==# s:cpath(a:1) : path
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:Cd(...) abort
|
|
||||||
let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd' : exists(':tcd') && haslocaldir(-1) ? 'tcd' : 'cd'
|
|
||||||
if !a:0
|
|
||||||
return cd
|
|
||||||
endif
|
|
||||||
let cwd = getcwd()
|
|
||||||
if s:cpath(cwd, a:1)
|
|
||||||
return ''
|
|
||||||
endif
|
|
||||||
exe cd s:fnameescape(a:1)
|
|
||||||
return cd . ' ' . s:fnameescape(cwd)
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
let s:executables = {}
|
let s:executables = {}
|
||||||
|
|
||||||
function! s:executable(binary) abort
|
function! s:executable(binary) abort
|
||||||
@@ -713,18 +700,11 @@ function! s:repo_git_command(...) dict abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:repo_git_chomp(...) dict abort
|
function! s:repo_git_chomp(...) dict abort
|
||||||
let git = g:fugitive_git_executable . ' --git-dir='.s:shellesc(self.git_dir)
|
return s:sub(system(FugitivePrepare(a:000, self.git_dir)), '\n$', '')
|
||||||
let output = git . join(map(copy(a:000),'" ".s:shellesc(v:val)'),'')
|
|
||||||
return s:sub(system(output), '\n$', '')
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:repo_git_chomp_in_tree(...) dict abort
|
function! s:repo_git_chomp_in_tree(...) dict abort
|
||||||
let cdback = s:Cd(self.tree())
|
|
||||||
try
|
|
||||||
return call(self.git_chomp, a:000, self)
|
return call(self.git_chomp, a:000, self)
|
||||||
finally
|
|
||||||
execute cdback
|
|
||||||
endtry
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:repo_rev_parse(rev) dict abort
|
function! s:repo_rev_parse(rev) dict abort
|
||||||
|
|||||||
Reference in New Issue
Block a user