Remove :Gwrite in :Git diff

This commit is contained in:
Tim Pope
2020-01-19 07:50:42 -05:00
parent 8d6f9734c1
commit 6b18f7b758
2 changed files with 6 additions and 26 deletions

View File

@@ -2131,9 +2131,7 @@ function! s:TempReadPre(file) abort
setlocal nomodeline setlocal nomodeline
setlocal bufhidden=delete nobuflisted setlocal bufhidden=delete nobuflisted
setlocal buftype=nowrite setlocal buftype=nowrite
if has_key(dict, 'modifiable') setlocal nomodifiable
let &l:modifiable = dict.modifiable
endif
if len(dict.dir) if len(dict.dir)
let b:git_dir = dict.dir let b:git_dir = dict.dir
call extend(b:, {'fugitive_type': 'temp'}, 'keep') call extend(b:, {'fugitive_type': 'temp'}, 'keep')
@@ -4617,7 +4615,7 @@ function! s:OpenExec(cmd, mods, args, ...) abort
else else
let filetype = 'git' let filetype = 'git'
endif endif
let s:temp_files[s:cpath(temp)] = { 'dir': dir, 'filetype': filetype, 'modifiable': first =~# '^diff ' } let s:temp_files[s:cpath(temp)] = { 'dir': dir, 'filetype': filetype }
if a:cmd ==# 'edit' if a:cmd ==# 'edit'
call s:BlurStatus() call s:BlurStatus()
endif endif
@@ -4704,26 +4702,8 @@ function! fugitive#WriteCommand(line1, line2, range, bang, mods, arg, args) abor
return 'wq' return 'wq'
elseif get(b:, 'fugitive_type', '') ==# 'index' elseif get(b:, 'fugitive_type', '') ==# 'index'
return 'Gcommit' return 'Gcommit'
elseif &buftype ==# 'nowrite' && getline(4) =~# '^+++ ' elseif &buftype ==# 'nowrite' && getline(4) =~# '^[+-]\{3\} '
let filename = getline(4)[6:-1] return 'echoerr ' . string('fugitive: :Gwrite from :Git diff has been removed in favor of :Git add --edit')
setlocal buftype=
silent write
setlocal buftype=nowrite
if matchstr(getline(2),'index [[:xdigit:]]\+\.\.\zs[[:xdigit:]]\{7\}') ==# fugitive#RevParse(':0:'.filename)[0:6]
let [message, exec_error] = s:ChompError(['apply', '--cached', '--reverse', '--', expand('%:p')])
else
let [message, exec_error] = s:ChompError(['apply', '--cached', '--', expand('%:p')])
endif
if exec_error
echohl ErrorMsg
echo message
echohl NONE
return ''
elseif a:bang
return 'bdelete'
else
return 'Gedit '.fnameescape(filename)
endif
endif endif
let mytab = tabpagenr() let mytab = tabpagenr()
let mybufnr = bufnr('') let mybufnr = bufnr('')
@@ -5450,7 +5430,7 @@ function! s:BlameSubcommand(line1, count, range, bang, mods, args) abort
endfor endfor
return '' return ''
endif endif
let temp_state = {'dir': s:Dir(), 'filetype': (raw ? '' : 'fugitiveblame'), 'blame_flags': flags, 'blame_file': file, 'modifiable': 0} let temp_state = {'dir': s:Dir(), 'filetype': (raw ? '' : 'fugitiveblame'), 'blame_flags': flags, 'blame_file': file}
if s:HasOpt(flags, '--reverse') if s:HasOpt(flags, '--reverse')
let temp_state.blame_reverse_end = matchstr(get(commits, 0, ''), '\.\.\zs.*') let temp_state.blame_reverse_end = matchstr(get(commits, 0, ''), '\.\.\zs.*')
endif endif

View File

@@ -317,7 +317,7 @@ P under the cursor. On untracked files, this instead
*fugitive_d* *fugitive_d*
Diff maps ~ Diff maps ~
*fugitive_dp* *fugitive_dp*
dp Invoke |:Git!| diff on the file under the cursor. dp Invoke |:Git| diff on the file under the cursor.
Deprecated in favor of inline diffs. Deprecated in favor of inline diffs.
*fugitive_dd* *fugitive_dd*