Fix escaping when :Grebase calls :Gcommit

This commit is contained in:
Tim Pope 2019-07-10 14:51:44 -04:00
parent 0a758c22b3
commit fd48cde3b7

View File

@ -3189,9 +3189,9 @@ function! s:Merge(cmd, bang, mods, args, ...) abort
let exec_error = s:ChompError([dir, 'diff-index', '--cached', '--quiet', 'HEAD', '--'])[1] let exec_error = s:ChompError([dir, 'diff-index', '--cached', '--quiet', 'HEAD', '--'])[1]
if exec_error && isdirectory(rdir) if exec_error && isdirectory(rdir)
if getfsize(rdir . '/amend') <= 0 if getfsize(rdir . '/amend') <= 0
return 'exe ' . string(mods . 'Gcommit -n -F ' . s:shellesc(rdir .'/message') . ' -e') . '|let b:fugitive_commit_rebase = 1' return 'exe ' . string(mods . 'Gcommit -n -F ' . s:fnameescape(rdir .'/message') . ' -e') . '|let b:fugitive_commit_rebase = 1'
elseif readfile(rdir . '/amend')[0] ==# fugitive#Head(-1, dir) elseif readfile(rdir . '/amend')[0] ==# fugitive#Head(-1, dir)
return 'exe ' . string(mods . 'Gcommit --amend -n -F ' . s:shellesc(rdir . '/message') . ' -e') . '|let b:fugitive_commit_rebase = 1' return 'exe ' . string(mods . 'Gcommit --amend -n -F ' . s:fnameescape(rdir . '/message') . ' -e') . '|let b:fugitive_commit_rebase = 1'
endif endif
endif endif
endif endif
@ -3274,10 +3274,10 @@ function! s:Merge(cmd, bang, mods, args, ...) abort
\ filereadable(fugitive#Find('.git/rebase-merge/done', dir)) && \ filereadable(fugitive#Find('.git/rebase-merge/done', dir)) &&
\ get(readfile(fugitive#Find('.git/rebase-merge/done', dir)), -1, '') =~# '^[^e]' \ get(readfile(fugitive#Find('.git/rebase-merge/done', dir)), -1, '') =~# '^[^e]'
cclose cclose
return 'exe ' . string(mods . 'Gcommit --amend -n -F ' . s:shellesc(fugitive#Find('.git/rebase-merge/message', dir)) . ' -e') . '|let b:fugitive_commit_rebase = 1' return 'exe ' . string(mods . 'Gcommit --amend -n -F ' . s:fnameescape(fugitive#Find('.git/rebase-merge/message', dir)) . ' -e') . '|let b:fugitive_commit_rebase = 1'
elseif !had_merge_msg && filereadable(fugitive#Find('.git/MERGE_MSG', dir)) elseif !had_merge_msg && filereadable(fugitive#Find('.git/MERGE_MSG', dir))
cclose cclose
return mods . 'Gcommit --no-status -n -t '.s:shellesc(fugitive#Find('.git/MERGE_MSG', dir)) return mods . 'Gcommit --no-status -n -t '.s:fnameescape(fugitive#Find('.git/MERGE_MSG', dir))
endif endif
endif endif
let qflist = getqflist() let qflist = getqflist()