:Gread is now equivalent to :Gread!

This commit is contained in:
Tim Pope 2010-01-11 15:21:43 -05:00
parent bfdcdf1fbd
commit 79339bfa81
2 changed files with 9 additions and 10 deletions

View File

@ -21,7 +21,7 @@ get back to the commit.
Edit a file in the work tree and make some changes. Use |:Gdiff| to open up Edit a file in the work tree and make some changes. Use |:Gdiff| to open up
the indexed version. Use |do| and |dp| on various hunks to bring the files in the indexed version. Use |do| and |dp| on various hunks to bring the files in
sync, or use |:Gread!| to pull in all changes. Write the indexed version to sync, or use |:Gread| to pull in all changes. Write the indexed version to
stage the file. stage the file.
Run |:Gblame| in a work tree file to see a blame in a vertical split. Press Run |:Gblame| in a work tree file to see a blame in a vertical split. Press
@ -90,14 +90,16 @@ that are part of Git repositories).
:Gpedit [revision] |:pedit| a |fugitive-revision| :Gpedit [revision] |:pedit| a |fugitive-revision|
*fugitive-:Gread* *fugitive-:Gread*
:Gread [revision] Empty the buffer and |:read| a |fugitive-revision|.
When the argument is omitted, this is similar to git
checkout on a work tree file or git add on a stage
file, but without writing anything to disk.
:{range}Gread [revision] :{range}Gread [revision]
|:read| a |fugitive-revision| |:read| in a |fugitive-revision| after {range}.
*fugitive-:Gread!* *fugitive-:Gread!*
:Gread! [revision] Empty the buffer and |:read| a |fugitive-revision|. :Gread! [revision] Deprecated synonym for |:Gread|.
This is similar to git checkout on a work tree file or
git add on a stage file, but without writing anything
to disk.
*fugitive-:Gwrite* *fugitive-:Gwrite*
:Gwrite Write to the current file's path and stage the results. :Gwrite Write to the current file's path and stage the results.

View File

@ -732,15 +732,12 @@ function! s:Edit(cmd,...) abort
catch /^fugitive:/ catch /^fugitive:/
return 'echoerr v:errmsg' return 'echoerr v:errmsg'
endtry endtry
if a:cmd =~# 'read!$' if a:cmd =~# 'read!$' || a:cmd ==# 'read'
return '%delete|read '.s:fnameescape(file).'|1delete_|diffupdate|'.line('.') return '%delete|read '.s:fnameescape(file).'|1delete_|diffupdate|'.line('.')
else else
if &previewwindow && getbufvar('','fugitive_type') ==# 'index' if &previewwindow && getbufvar('','fugitive_type') ==# 'index'
wincmd p wincmd p
endif endif
if a:cmd == 'read'
call s:warn('Use :.Gread for future compatibility')
endif
return a:cmd.' '.s:fnameescape(file) return a:cmd.' '.s:fnameescape(file)
endif endif
endfunction endfunction