Skip to content
Snippets Groups Projects
Commit cf894103 authored by Jerome Reybert's avatar Jerome Reybert
Browse files

plaugin/magit.vim: output an understandable message when user tries ot discard...

plaugin/magit.vim: output an understandable message when user tries ot discard an untracked file (fix #58)
parent 826432e8
Branches
Tags
No related merge requests found
......@@ -728,10 +728,21 @@ function! s:mg_stage_closed_file(discard)
endif
else
if ( section == 'unstaged' )
if ( file.status == '?' )
echohl WarningMsg
echomsg "By default, vimagit won't discard "
\ "untracked file (which means delete this file)"
echohl None
return
else
call magit#git#git_checkout(magit#utils#add_quotes(filename))
endif
else
echoerr "Must be in \"" .
\ g:magit_sections.unstaged . "\" section"
echohl WarningMsg
echomsg "Can not discard file in \"" .
\ g:magit_sections.staged . "\" section, "
\ "unstage file first."
echohl None
endif
endif
call magit#update_buffer()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment