Recover from deleted temp script

Closes https://github.com/tpope/vim-fugitive/issues/1616
This commit is contained in:
Tim Pope
2020-10-26 20:31:54 -04:00
parent 89e6b5e4e1
commit 1a77f1c00e

View File

@@ -146,11 +146,13 @@ endif
function! s:TempScript(...) abort
let body = join(a:000, "\n")
if !has_key(s:temp_scripts, body)
let temp = tempname() . '.sh'
call writefile(['#!/bin/sh'] + a:000, temp)
let s:temp_scripts[body] = temp
let s:temp_scripts[body] = tempname() . '.sh'
endif
return FugitiveGitPath(s:temp_scripts[body])
let temp = s:temp_scripts[body]
if !filereadable(temp)
call writefile(['#!/bin/sh'] + a:000, temp)
endif
return FugitiveGitPath(temp)
endfunction
function! s:DoAutocmd(cmd) abort