Unstage single files from git move and do not move them back

This fixes #824
This commit is contained in:
kaihowl
2017-05-14 12:48:03 +02:00
committed by Tim Pope
parent e5935c1165
commit 1d2f150331

View File

@@ -975,11 +975,14 @@ function! s:StageToggle(lnum1,lnum2) abort
continue
endif
execute lnum
if filename =~ ' -> '
let cmd = ['mv','--'] + reverse(split(filename,' -> '))
let filename = cmd[-1]
elseif section ==# 'staged'
let cmd = ['reset','-q','--',filename]
if section ==# 'staged'
if filename =~ ' -> '
let files_to_unstage = split(filename,' -> ')
else
let files_to_unstage = [filename]
endif
let filename = files_to_unstage[-1]
let cmd = ['reset','-q','--'] + files_to_unstage
elseif getline(lnum) =~# '^#\tdeleted:'
let cmd = ['rm','--',filename]
elseif getline(lnum) =~# '^#\tmodified:'