Revert accidentally committed changes
This partially reverts commit 65be0ae749
.
This commit is contained in:
parent
eeaadf7255
commit
26433842e9
@ -93,7 +93,7 @@ endfunction
|
||||
function! s:recall() abort
|
||||
let rev = s:sub(s:buffer().rev(), '^/', '')
|
||||
if rev ==# ':'
|
||||
return matchstr(getline('.'),'^.\=\t\%([[:alpha:] ]\+: *\)\=\zs.\{-\}\ze\%( ([^()[:digit:]]\+)\)\=$\|^\d\{6} \x\{40\} \d\t\zs.*')
|
||||
return matchstr(getline('.'),'^#\t\%([[:alpha:] ]\+: *\)\=\zs.\{-\}\ze\%( ([^()[:digit:]]\+)\)\=$\|^\d\{6} \x\{40\} \d\t\zs.*')
|
||||
elseif s:buffer().type('tree')
|
||||
let file = matchstr(getline('.'), '\t\zs.*')
|
||||
if empty(file) && line('.') > 2
|
||||
@ -867,7 +867,7 @@ function! fugitive#ReloadStatus() abort
|
||||
endfunction
|
||||
|
||||
function! s:stage_info(lnum) abort
|
||||
let filename = matchstr(getline(a:lnum),'^.\=\t\zs.\{-\}\ze\%( ([^()[:digit:]]\+)\)\=$')
|
||||
let filename = matchstr(getline(a:lnum),'^#\t\zs.\{-\}\ze\%( ([^()[:digit:]]\+)\)\=$')
|
||||
let lnum = a:lnum
|
||||
if has('multi_byte_encoding')
|
||||
let colon = '\%(:\|\%uff1a\)'
|
||||
@ -879,13 +879,13 @@ function! s:stage_info(lnum) abort
|
||||
endwhile
|
||||
if !lnum
|
||||
return ['', '']
|
||||
elseif (getline(lnum+1) =~# '^.\= .*\<git \%(reset\|rm --cached\) ' && getline(lnum+2) ==# '#') || getline(lnum) =~# '^\%(. \)\=Changes to be committed:$'
|
||||
elseif (getline(lnum+1) =~# '^# .*\<git \%(reset\|rm --cached\) ' && getline(lnum+2) ==# '#') || getline(lnum) ==# '# Changes to be committed:'
|
||||
return [matchstr(filename, colon.' *\zs.*'), 'staged']
|
||||
elseif (getline(lnum+1) =~# '^.\= .*\<git add ' && getline(lnum+2) ==# '#' && getline(lnum+3) !~# colon.' ') || getline(lnum) =~# '^\(. \)\=Untracked files:$'
|
||||
elseif (getline(lnum+1) =~# '^# .*\<git add ' && getline(lnum+2) ==# '#' && getline(lnum+3) !~# colon.' ') || getline(lnum) ==# '# Untracked files:'
|
||||
return [filename, 'untracked']
|
||||
elseif getline(lnum+2) =~# '^.\= .*\<git checkout ' || getline(lnum) =~# '\%(. \)\=Changes not staged for commit:$'
|
||||
elseif getline(lnum+2) =~# '^# .*\<git checkout ' || getline(lnum) ==# '# Changes not staged for commit:'
|
||||
return [matchstr(filename, colon.' *\zs.*'), 'unstaged']
|
||||
elseif getline(lnum+2) =~# '^.\= .*\<git \%(add\|rm\)' || getline(lnum) =~# '\%(. \)\=Unmerged paths:$'
|
||||
elseif getline(lnum+2) =~# '^# .*\<git \%(add\|rm\)' || getline(lnum) ==# '# Unmerged paths:'
|
||||
return [matchstr(filename, colon.' *\zs.*'), 'unmerged']
|
||||
else
|
||||
return ['', 'unknown']
|
||||
@ -894,7 +894,7 @@ endfunction
|
||||
|
||||
function! s:StageNext(count) abort
|
||||
for i in range(a:count)
|
||||
call search('^.\=\t.*','W')
|
||||
call search('^#\t.*','W')
|
||||
endfor
|
||||
return '.'
|
||||
endfunction
|
||||
@ -904,7 +904,7 @@ function! s:StagePrevious(count) abort
|
||||
return 'CtrlP '.fnameescape(s:repo().tree())
|
||||
else
|
||||
for i in range(a:count)
|
||||
call search('^.\=\t.*','Wbe')
|
||||
call search('^#\t.*','Wbe')
|
||||
endfor
|
||||
return '.'
|
||||
endif
|
||||
@ -912,14 +912,14 @@ endfunction
|
||||
|
||||
function! s:StageReloadSeek(target,lnum1,lnum2) abort
|
||||
let jump = a:target
|
||||
let f = matchstr(getline(a:lnum1-1),'^.\=\t\%([[:alpha:] ]\+: *\|.*\%uff1a *\)\=\zs.*')
|
||||
let f = matchstr(getline(a:lnum1-1),'^#\t\%([[:alpha:] ]\+: *\|.*\%uff1a *\)\=\zs.*')
|
||||
if f !=# '' | let jump = f | endif
|
||||
let f = matchstr(getline(a:lnum2+1),'^.\=\t\%([[:alpha:] ]\+: *\|.*\%uff1a *\)\=\zs.*')
|
||||
let f = matchstr(getline(a:lnum2+1),'^#\t\%([[:alpha:] ]\+: *\|.*\%uff1a *\)\=\zs.*')
|
||||
if f !=# '' | let jump = f | endif
|
||||
silent! edit!
|
||||
1
|
||||
redraw
|
||||
call search('^.\=\t\%([[:alpha:] ]\+: *\|.*\%uff1a *\)\=\V'.jump.'\%( ([^()[:digit:]]\+)\)\=\$','W')
|
||||
call search('^#\t\%([[:alpha:] ]\+: *\|.*\%uff1a *\)\=\V'.jump.'\%( ([^()[:digit:]]\+)\)\=\$','W')
|
||||
endfunction
|
||||
|
||||
function! s:StageUndo() abort
|
||||
@ -976,8 +976,8 @@ function! s:StageDiffEdit() abort
|
||||
if arg ==# '.'
|
||||
silent! edit!
|
||||
1
|
||||
if !search('^.*:\n.*\n.\= .*"git checkout \|^\%(# \)=Changes not staged for commit:$','W')
|
||||
call search(':$','W')
|
||||
if !search('^# .*:\n#.*\n# .*"git checkout \|^# Changes not staged for commit:$','W')
|
||||
call search('^# .*:$','W')
|
||||
endif
|
||||
else
|
||||
call s:StageReloadSeek(arg,line('.'),line('.'))
|
||||
@ -997,28 +997,28 @@ function! s:StageToggle(lnum1,lnum2) abort
|
||||
for lnum in range(a:lnum1,a:lnum2)
|
||||
let [filename, section] = s:stage_info(lnum)
|
||||
let repo = s:repo()
|
||||
if getline('.') =~# ':$'
|
||||
if getline('.') =~# '^# .*:$'
|
||||
if section ==# 'staged'
|
||||
call repo.git_chomp_in_tree('reset','-q')
|
||||
silent! edit!
|
||||
1
|
||||
if !search('^.*:\n.\= .*"git add .*\n#\n\|^\%(. \)\=Untracked files:$','W')
|
||||
call search(':$','W')
|
||||
if !search('^# .*:\n# .*"git add .*\n#\n\|^# Untracked files:$','W')
|
||||
call search('^# .*:$','W')
|
||||
endif
|
||||
return ''
|
||||
elseif section ==# 'unstaged'
|
||||
call repo.git_chomp_in_tree('add','-u')
|
||||
silent! edit!
|
||||
1
|
||||
if !search('^.*:\n\.\= .*"git add .*\n#\n\|^\%( \)=Untracked files:$','W')
|
||||
call search(':$','W')
|
||||
if !search('^# .*:\n# .*"git add .*\n#\n\|^# Untracked files:$','W')
|
||||
call search('^# .*:$','W')
|
||||
endif
|
||||
return ''
|
||||
else
|
||||
call repo.git_chomp_in_tree('add','.')
|
||||
silent! edit!
|
||||
1
|
||||
call search(':$','W')
|
||||
call search('^# .*:$','W')
|
||||
return ''
|
||||
endif
|
||||
endif
|
||||
@ -1034,9 +1034,9 @@ function! s:StageToggle(lnum1,lnum2) abort
|
||||
endif
|
||||
let filename = files_to_unstage[-1]
|
||||
let cmd = ['reset','-q','--'] + files_to_unstage
|
||||
elseif getline(lnum) =~# '^.\=\tdeleted:'
|
||||
elseif getline(lnum) =~# '^#\tdeleted:'
|
||||
let cmd = ['rm','--',filename]
|
||||
elseif getline(lnum) =~# '^.\=\tmodified:'
|
||||
elseif getline(lnum) =~# '^#\tmodified:'
|
||||
let cmd = ['add','--',filename]
|
||||
else
|
||||
let cmd = ['add','-A','--',filename]
|
||||
@ -1062,11 +1062,11 @@ function! s:StagePatch(lnum1,lnum2) abort
|
||||
|
||||
for lnum in range(a:lnum1,a:lnum2)
|
||||
let [filename, section] = s:stage_info(lnum)
|
||||
if getline('.') =~# ':$' && section ==# 'staged'
|
||||
if getline('.') =~# '^# .*:$' && section ==# 'staged'
|
||||
return 'Git reset --patch'
|
||||
elseif getline('.') =~# ':$' && section ==# 'unstaged'
|
||||
elseif getline('.') =~# '^# .*:$' && section ==# 'unstaged'
|
||||
return 'Git add --patch'
|
||||
elseif getline('.') =~# ':$' && section ==# 'untracked'
|
||||
elseif getline('.') =~# '^# .*:$' && section ==# 'untracked'
|
||||
return 'Git add -N .'
|
||||
elseif filename ==# ''
|
||||
continue
|
||||
@ -1079,7 +1079,7 @@ function! s:StagePatch(lnum1,lnum2) abort
|
||||
let reset += [split(filename,' -> ')[1]]
|
||||
elseif section ==# 'staged'
|
||||
let reset += [filename]
|
||||
elseif getline(lnum) !~# '^.\=\tdeleted:'
|
||||
elseif getline(lnum) !~# '^#\tdeleted:'
|
||||
let add += [filename]
|
||||
endif
|
||||
endfor
|
||||
@ -1094,7 +1094,7 @@ function! s:StagePatch(lnum1,lnum2) abort
|
||||
silent! edit!
|
||||
1
|
||||
redraw
|
||||
call search('^.\=\t\%([[:alpha:] ]\+: *\)\=\V'.first_filename.'\%( ([^()[:digit:]]\+)\)\=\$','W')
|
||||
call search('^#\t\%([[:alpha:] ]\+: *\)\=\V'.first_filename.'\%( ([^()[:digit:]]\+)\)\=\$','W')
|
||||
endif
|
||||
catch /^fugitive:/
|
||||
return 'echoerr v:errmsg'
|
||||
@ -2931,25 +2931,25 @@ function! s:cfile() abort
|
||||
let file = ':'.s:sub(matchstr(getline('.'),'\d\t.*'),'\t',':')
|
||||
return [file]
|
||||
|
||||
elseif getline('.') =~# '^.\=\trenamed:.* -> '
|
||||
elseif getline('.') =~# '^#\trenamed:.* -> '
|
||||
let file = '/'.matchstr(getline('.'),' -> \zs.*')
|
||||
return [file]
|
||||
elseif getline('.') =~# '^.\=\t\(\k\| \)\+\p\?: *.'
|
||||
elseif getline('.') =~# '^#\t\(\k\| \)\+\p\?: *.'
|
||||
let file = '/'.matchstr(getline('.'),': *\zs.\{-\}\ze\%( ([^()[:digit:]]\+)\)\=$')
|
||||
return [file]
|
||||
elseif getline('.') =~# '^.\=\t.'
|
||||
let file = '/'.matchstr(getline('.'),'\t\zs.*')
|
||||
elseif getline('.') =~# '^#\t.'
|
||||
let file = '/'.matchstr(getline('.'),'#\t\zs.*')
|
||||
return [file]
|
||||
elseif getline('.') =~# ': needs merge$'
|
||||
let file = '/'.matchstr(getline('.'),'.*\ze: needs merge$')
|
||||
return [file, 'Gdiff!']
|
||||
|
||||
elseif getline('.') =~# '^\%(. \)\=Not currently on any branch.$'
|
||||
elseif getline('.') ==# '# Not currently on any branch.'
|
||||
return ['HEAD']
|
||||
elseif getline('.') =~# '^\%(. \)\=On branch '
|
||||
elseif getline('.') =~# '^# On branch '
|
||||
let file = 'refs/heads/'.getline('.')[12:]
|
||||
return [file]
|
||||
elseif getline('.') =~# "^\\%(. \\)\=Your branch .*'"
|
||||
elseif getline('.') =~# "^# Your branch .*'"
|
||||
let file = matchstr(getline('.'),"'\\zs\\S\\+\\ze'")
|
||||
return [file]
|
||||
endif
|
||||
|
Loading…
Reference in New Issue
Block a user