Store more than just dir in s:temp_files
- Also store 'args', the git arguments used to generate the temp file
This commit is contained in:
parent
8f0b8edfbd
commit
190fe2a4cf
@ -1142,7 +1142,8 @@ function! s:Edit(cmd,bang,...) abort
|
||||
endif
|
||||
|
||||
if a:bang
|
||||
let args = s:gsub(join(a:000, ' '), '\\@<!%(\\\\)*\zs[%#]', '\=s:buffer().expand(submatch(0))')
|
||||
let arglist = map(copy(a:000), 's:gsub(v:val, ''\\@<!%(\\\\)*\zs[%#]'', ''\=s:buffer().expand(submatch(0))'')')
|
||||
let args = join(arglist, ' ')
|
||||
if a:cmd =~# 'read'
|
||||
let git = buffer.repo().git_command()
|
||||
let last = line('$')
|
||||
@ -1155,7 +1156,7 @@ function! s:Edit(cmd,bang,...) abort
|
||||
return 'redraw|echo '.string(':!'.git.' '.args)
|
||||
else
|
||||
let temp = resolve(tempname())
|
||||
let s:temp_files[temp] = buffer.repo().dir()
|
||||
let s:temp_files[temp] = { 'dir': buffer.repo().dir(), 'args': arglist }
|
||||
silent execute a:cmd.' '.temp
|
||||
if a:cmd =~# 'pedit'
|
||||
wincmd P
|
||||
@ -1630,7 +1631,8 @@ function! s:Blame(bang,line1,line2,count,args) abort
|
||||
else
|
||||
let cmd += ['--contents', '-']
|
||||
endif
|
||||
let basecmd = escape(call(s:repo().git_command,cmd+['--',s:buffer().path()],s:repo()),'!')
|
||||
let cmd += ['--', s:buffer().path()]
|
||||
let basecmd = escape(call(s:repo().git_command,cmd,s:repo()),'!')
|
||||
try
|
||||
let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd '
|
||||
if !s:repo().bare()
|
||||
@ -1671,7 +1673,7 @@ function! s:Blame(bang,line1,line2,count,args) abort
|
||||
setlocal scrollbind nowrap nofoldenable
|
||||
let top = line('w0') + &scrolloff
|
||||
let current = line('.')
|
||||
let s:temp_files[temp] = s:repo().dir()
|
||||
let s:temp_files[temp] = { 'dir': s:repo().dir(), 'args': cmd }
|
||||
exe 'keepalt leftabove vsplit '.temp
|
||||
let b:fugitive_blamed_bufnr = bufnr
|
||||
let w:fugitive_leave = restore
|
||||
@ -2309,8 +2311,9 @@ augroup fugitive_temp
|
||||
autocmd!
|
||||
autocmd BufNewFile,BufReadPost *
|
||||
\ if has_key(s:temp_files,expand('<afile>:p')) |
|
||||
\ let b:git_dir = s:temp_files[expand('<afile>:p')] |
|
||||
\ let b:git_dir = s:temp_files[expand('<afile>:p')].dir |
|
||||
\ let b:git_type = 'temp' |
|
||||
\ let b:git_args = s:temp_files[expand('<afile>:p')].args |
|
||||
\ call fugitive#detect(expand('<afile>:p')) |
|
||||
\ setlocal bufhidden=delete |
|
||||
\ nnoremap <buffer> <silent> q :<C-U>bdelete<CR>|
|
||||
|
Loading…
Reference in New Issue
Block a user