Use -- to disambiguate arguments
This is to enable future replacement of s:Prepare() with fugitive#Prepare().
This commit is contained in:
parent
2b5effe2f1
commit
b1ab990314
@ -269,7 +269,7 @@ function! fugitive#Head(...) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! fugitive#RevParse(rev, ...) abort
|
function! fugitive#RevParse(rev, ...) abort
|
||||||
let hash = system(s:Prepare(a:0 ? a:1 : b:git_dir, 'rev-parse', '--verify', a:rev))[0:-2]
|
let hash = system(s:Prepare(a:0 ? a:1 : b:git_dir, 'rev-parse', '--verify', a:rev, '--'))[0:-2]
|
||||||
if !v:shell_error && hash =~# '^\x\{40\}$'
|
if !v:shell_error && hash =~# '^\x\{40\}$'
|
||||||
return hash
|
return hash
|
||||||
endif
|
endif
|
||||||
@ -300,7 +300,7 @@ function! fugitive#RemoteUrl(...) abort
|
|||||||
if fugitive#GitVersion() =~# '^[01]\.\|^2\.[0-6]\.'
|
if fugitive#GitVersion() =~# '^[01]\.\|^2\.[0-6]\.'
|
||||||
return fugitive#Config('remote.' . remote . '.url')
|
return fugitive#Config('remote.' . remote . '.url')
|
||||||
endif
|
endif
|
||||||
let cmd = s:Prepare(dir, 'remote', 'get-url', remote)
|
let cmd = s:Prepare(dir, 'remote', 'get-url', remote, '--')
|
||||||
let out = substitute(system(cmd), "\n$", '', '')
|
let out = substitute(system(cmd), "\n$", '', '')
|
||||||
return v:shell_error ? '' : out
|
return v:shell_error ? '' : out
|
||||||
endfunction
|
endfunction
|
||||||
@ -589,7 +589,7 @@ function! fugitive#Route(object, ...) abort
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
if commit !~# '^[0-9a-f]\{40\}$'
|
if commit !~# '^[0-9a-f]\{40\}$'
|
||||||
let commit = system(s:Prepare(dir, 'rev-parse', '--verify', commit))[0:-2]
|
let commit = system(s:Prepare(dir, 'rev-parse', '--verify', commit, '--'))[0:-2]
|
||||||
let commit = v:shell_error ? '' : commit
|
let commit = v:shell_error ? '' : commit
|
||||||
endif
|
endif
|
||||||
if len(commit)
|
if len(commit)
|
||||||
@ -775,7 +775,7 @@ function! fugitive#getfsize(url) abort
|
|||||||
let entry = s:PathInfo(a:url)
|
let entry = s:PathInfo(a:url)
|
||||||
if entry[4] == -2 && entry[2] ==# 'blob' && len(entry[3])
|
if entry[4] == -2 && entry[2] ==# 'blob' && len(entry[3])
|
||||||
let dir = s:DirCommitFile(a:url)[0]
|
let dir = s:DirCommitFile(a:url)[0]
|
||||||
let size = +system(s:Prepare(dir, 'cat-file', '-s', entry[3]))
|
let size = +system(s:Prepare(dir, 'cat-file', '-s', entry[3], '--'))
|
||||||
let entry[4] = v:shell_error ? -1 : size
|
let entry[4] = v:shell_error ? -1 : size
|
||||||
endif
|
endif
|
||||||
return entry[4]
|
return entry[4]
|
||||||
@ -867,7 +867,7 @@ function! s:BlobTemp(url) abort
|
|||||||
endif
|
endif
|
||||||
if commit =~# '^\d$' || !filereadable(tempfile)
|
if commit =~# '^\d$' || !filereadable(tempfile)
|
||||||
let rev = s:DirRev(a:url)[1]
|
let rev = s:DirRev(a:url)[1]
|
||||||
let command = s:Prepare(dir, 'cat-file', 'blob', rev)
|
let command = s:Prepare(dir, 'cat-file', 'blob', rev, '--')
|
||||||
call s:TempCmd(tempfile, command)
|
call s:TempCmd(tempfile, command)
|
||||||
if v:shell_error
|
if v:shell_error
|
||||||
call delete(tempfile)
|
call delete(tempfile)
|
||||||
@ -1289,9 +1289,9 @@ function! fugitive#FileReadCmd(...) abort
|
|||||||
return 'noautocmd ' . line . 'read ' . s:fnameescape(amatch)
|
return 'noautocmd ' . line . 'read ' . s:fnameescape(amatch)
|
||||||
endif
|
endif
|
||||||
if rev !~# ':'
|
if rev !~# ':'
|
||||||
let cmd = s:Prepare(dir, 'log', '--pretty=format:%B', '-1', rev)
|
let cmd = s:Prepare(dir, 'log', '--pretty=format:%B', '-1', rev, '--')
|
||||||
else
|
else
|
||||||
let cmd = s:Prepare(dir, 'cat-file', '-p', rev)
|
let cmd = s:Prepare(dir, 'cat-file', '-p', rev, '--')
|
||||||
endif
|
endif
|
||||||
return line . 'read !' . escape(cmd, '!#%')
|
return line . 'read !' . escape(cmd, '!#%')
|
||||||
endfunction
|
endfunction
|
||||||
@ -1308,10 +1308,10 @@ function! fugitive#FileWriteCmd(...) abort
|
|||||||
if commit !~# '^[0-3]$' || !v:cmdbang && (line("'[") != 1 || line("']") != line('$'))
|
if commit !~# '^[0-3]$' || !v:cmdbang && (line("'[") != 1 || line("']") != line('$'))
|
||||||
return "noautocmd '[,']write" . (v:cmdbang ? '!' : '') . ' ' . s:fnameescape(amatch)
|
return "noautocmd '[,']write" . (v:cmdbang ? '!' : '') . ' ' . s:fnameescape(amatch)
|
||||||
endif
|
endif
|
||||||
silent execute "'[,']write !".s:Prepare(dir, 'hash-object', '-w', '--stdin').' > '.tmp
|
silent execute "'[,']write !".s:Prepare(dir, 'hash-object', '-w', '--stdin', '--').' > '.tmp
|
||||||
let sha1 = readfile(tmp)[0]
|
let sha1 = readfile(tmp)[0]
|
||||||
let old_mode = matchstr(system(s:Prepare(dir, 'ls-files', '--stage', file[1:-1])), '^\d\+')
|
let old_mode = matchstr(system(s:Prepare(dir, 'ls-files', '--stage', '--', '.' . file)), '^\d\+')
|
||||||
if old_mode == ''
|
if empty(old_mode)
|
||||||
let old_mode = executable(s:Tree(dir) . file) ? '100755' : '100644'
|
let old_mode = executable(s:Tree(dir) . file) ? '100755' : '100644'
|
||||||
endif
|
endif
|
||||||
let info = old_mode.' '.sha1.' '.commit."\t".file[1:-1]
|
let info = old_mode.' '.sha1.' '.commit."\t".file[1:-1]
|
||||||
|
Loading…
Reference in New Issue
Block a user