Support submodules in :Gstatus

This commit is contained in:
Tim Pope 2011-01-08 16:49:48 -05:00
parent 9bbea8a2a1
commit 33ea0aa4e7

View File

@ -548,7 +548,7 @@ endfunction
function! s:StageDiff(bang) abort function! s:StageDiff(bang) abort
let section = getline(search('^# .*:$','bnW')) let section = getline(search('^# .*:$','bnW'))
let line = getline('.') let line = getline('.')
let filename = matchstr(line,'^#\t\%([[:alpha:] ]\+: *\)\=\zs.*') let filename = matchstr(line,'^#\t\%([[:alpha:] ]\+: *\)\=\zs.\{-\}\ze\%( (new commits)\)\=$')
if filename ==# '' && section == '# Changes to be committed:' if filename ==# '' && section == '# Changes to be committed:'
return 'Git diff --cached' return 'Git diff --cached'
elseif filename ==# '' elseif filename ==# ''
@ -574,7 +574,7 @@ function! s:StageToggle(lnum1,lnum2) abort
if getline('.') == '# Changes to be committed:' if getline('.') == '# Changes to be committed:'
return 'Gcommit' return 'Gcommit'
endif endif
let filename = matchstr(line,'^#\t\%([[:alpha:] ]\+: *\)\=\zs.*') let filename = matchstr(line,'^#\t\%([[:alpha:] ]\+: *\)\=\zs.\{-\}\ze\%( (new commits)\)\=$')
if filename ==# '' if filename ==# ''
continue continue
endif endif
@ -604,7 +604,7 @@ function! s:StageToggle(lnum1,lnum2) abort
silent! edit! silent! edit!
1 1
redraw redraw
call search('^#\t\%([[:alpha:] ]\+: *\)\=\V'.jump.'\$','W') call search('^#\t\%([[:alpha:] ]\+: *\)\=\V'.jump.'\%( (new commits)\)\=\$','W')
endif endif
echo s:sub(s:gsub(output,'\n+','\n'),'\n$','') echo s:sub(s:gsub(output,'\n+','\n'),'\n$','')
catch /^fugitive:/ catch /^fugitive:/
@ -624,7 +624,7 @@ function! s:StagePatch(lnum1,lnum2) abort
elseif line == '# Changed but not updated:' elseif line == '# Changed but not updated:'
return 'Git add --patch' return 'Git add --patch'
endif endif
let filename = matchstr(line,'^#\t\%([[:alpha:] ]\+: *\)\=\zs.*') let filename = matchstr(line,'^#\t\%([[:alpha:] ]\+: *\)\=\zs.\{-\}\ze\%( (new commits)\)\=$')
if filename ==# '' if filename ==# ''
continue continue
endif endif
@ -652,7 +652,7 @@ function! s:StagePatch(lnum1,lnum2) abort
silent! edit! silent! edit!
1 1
redraw redraw
call search('^#\t\%([[:alpha:] ]\+: *\)\=\V'.first_filename.'\$','W') call search('^#\t\%([[:alpha:] ]\+: *\)\=\V'.first_filename.'\%( (new commits)\)\=\$','W')
endif endif
catch /^fugitive:/ catch /^fugitive:/
return 'echoerr v:errmsg' return 'echoerr v:errmsg'
@ -1631,7 +1631,7 @@ function! s:GF(mode) abort
let file = '/'.matchstr(getline('.'),' -> \zs.*') let file = '/'.matchstr(getline('.'),' -> \zs.*')
return s:Edit(a:mode,file) return s:Edit(a:mode,file)
elseif getline('.') =~# '^#\t[[:alpha:] ]\+: *.' elseif getline('.') =~# '^#\t[[:alpha:] ]\+: *.'
let file = '/'.matchstr(getline('.'),': *\zs.*') let file = '/'.matchstr(getline('.'),': *\zs.\{-\}\ze\%( (new commits)\)\=$')
return s:Edit(a:mode,file) return s:Edit(a:mode,file)
elseif getline('.') =~# '^#\t.' elseif getline('.') =~# '^#\t.'
let file = '/'.matchstr(getline('.'),'#\t\zs.*') let file = '/'.matchstr(getline('.'),'#\t\zs.*')