mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-15 06:43:51 -05:00
Support X for submodules
Staged/[MD]: Unstage and checkout superproject recorded version Staged/A: Noop. 'git rm -f' would be appropriate but it is destructive for non-staged changes and hard to undo Unstaged/A: Noop. Hard to reproduce in practice, 'git status' doesn't handle it well and hard to undo Unstaged/[MD]: Checkout superproject recorded version Unstaged/[m?]: Noop. Discarding submodules content changes is too complicated. Workaround is to <CR> to submodule and discard from it's :Gstatus.
This commit is contained in:
committed by
Tim Pope
parent
f779b90fbd
commit
a21ca7e86e
@@ -1654,12 +1654,12 @@ function! fugitive#BufReadStatus() abort
|
||||
let i += 1
|
||||
let file = output[i] . ' -> ' . matchstr(file, ' \zs.*')
|
||||
endif
|
||||
let sub = matchstr(line, '^[12u] .. \zs....')
|
||||
if line[2] !=# '.'
|
||||
call add(staged, {'type': 'File', 'status': line[2], 'filename': file})
|
||||
call add(staged, {'type': 'File', 'status': line[2], 'filename': file, 'sub': sub})
|
||||
endif
|
||||
if line[3] !=# '.'
|
||||
let sub = matchstr(line, '^[12u] .. \zs....')
|
||||
call add(unstaged, {'type': 'File', 'status': get({'C':'M','M':'?','U':'?'}, matchstr(sub, 'S\.*\zs[CMU]'), line[3]), 'filename': file})
|
||||
call add(unstaged, {'type': 'File', 'status': get({'C':'M','M':'?','U':'?'}, matchstr(sub, 'S\.*\zs[CMU]'), line[3]), 'filename': file, 'sub': sub})
|
||||
endif
|
||||
endif
|
||||
let i += 1
|
||||
@@ -1697,12 +1697,12 @@ function! fugitive#BufReadStatus() abort
|
||||
let i += 1
|
||||
endif
|
||||
if line[0] !~# '[ ?!#]'
|
||||
call add(staged, {'type': 'File', 'status': line[0], 'filename': files})
|
||||
call add(staged, {'type': 'File', 'status': line[0], 'filename': files, 'sub': ''})
|
||||
endif
|
||||
if line[0:1] ==# '??'
|
||||
call add(untracked, {'type': 'File', 'status': line[1], 'filename': files})
|
||||
elseif line[1] !~# '[ !#]'
|
||||
call add(unstaged, {'type': 'File', 'status': line[1], 'filename': files})
|
||||
call add(unstaged, {'type': 'File', 'status': line[1], 'filename': files, 'sub': ''})
|
||||
endif
|
||||
endwhile
|
||||
endif
|
||||
@@ -3074,6 +3074,20 @@ function! s:StageDelete(lnum1, lnum2, count) abort
|
||||
if empty(info.paths)
|
||||
continue
|
||||
endif
|
||||
let sub = get(get(get(b:fugitive_files, info.section, {}), info.filename, {}), 'sub')
|
||||
if sub =~# '^S'
|
||||
if info.status ==# 'A'
|
||||
continue
|
||||
endif
|
||||
if info.section ==# 'Staged'
|
||||
call s:TreeChomp('reset', '--', info.paths[0])
|
||||
endif
|
||||
if info.status =~# '[MD]'
|
||||
call s:TreeChomp('submodule', 'update', '--', info.paths[0])
|
||||
call add(restore, ':Git -C ' . info.relative[0] . ' checkout -')
|
||||
endif
|
||||
continue
|
||||
endif
|
||||
if info.status ==# 'D'
|
||||
let undo = 'Gremove'
|
||||
elseif info.paths[0] =~# '/$'
|
||||
|
||||
Reference in New Issue
Block a user