Skip to content

Commit

Permalink
Allow X on the 'Staged' and 'Untracked' headers
Browse files Browse the repository at this point in the history
This irreversibly throws away the changes.

Fixes tpope#2063
  • Loading branch information
TamaMcGlinn committed May 1, 2023
1 parent 5f0d280 commit f5bc0ca
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion autoload/fugitive.vim
Original file line number Diff line number Diff line change
Expand Up @@ -4994,7 +4994,22 @@ function! s:StageDelete(lnum1, lnum2, count) abort
let did_conflict_err = 0
let reset_commit = matchstr(getline(a:lnum1), '^Un\w\+ \%(to\| from\) \zs\S\+')
try
for info in s:Selection(a:lnum1, a:lnum2)
let selection=s:Selection(a:lnum1, a:lnum2)
if empty(selection)
let first_line = getline(a:lnum1)
if first_line =~# '^Unstaged ([0-9]*)$'
call s:TreeChomp('checkout', '--', FugitiveWorkTree())
" redraw
exe s:ReloadStatus()
call s:StageReveal()
elseif first_line =~# '^Untracked ([0-9]*)$'
call s:TreeChomp('clean', '-f')
" redraw
exe s:ReloadStatus()
call s:StageReveal()
endif
endif
for info in selection
if empty(info.paths)
if len(info.commit)
let reset_commit = info.commit . '^'
Expand Down

0 comments on commit f5bc0ca

Please sign in to comment.