Skip to content

Commit

Permalink
Added GitVimDiffMergeDone().
Browse files Browse the repository at this point in the history
  • Loading branch information
motemen committed May 17, 2008
1 parent da1c5dc commit a7d32d1
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions plugin/git.vim
Expand Up @@ -134,22 +134,46 @@ endfunction
function! GitVimDiffMerge()
let file = s:Expand('%')
let filetype = &filetype
let t:git_vimdiff_original_bufnr = bufnr('%')
let t:git_vimdiff_buffers = []

top new
topleft new
set buftype=nofile
file `=':2:' . file`
call add(t:git_vimdiff_buffers, bufnr('%'))
execute 'silent read!git show :2:' . file
0d
diffthis
let &filetype = filetype

rightbelow vnew
set buftype=nofile
file `=':3:' . file`
call add(t:git_vimdiff_buffers, bufnr('%'))
execute 'silent read!git show :3:' . file
0d
diffthis
let &filetype = filetype
endfunction

function! GitVimDiffMergeDone()
if exists('t:git_vimdiff_original_bufnr') && exists('t:git_vimdiff_buffers')
if getbufline(t:git_vimdiff_buffers[0], 1, '$') == getbufline(t:git_vimdiff_buffers[1], 1, '$')
execute 'sbuffer ' . t:git_vimdiff_original_bufnr
0put=getbufline(t:git_vimdiff_buffers[0], 1, '$')
normal! jdG
update
execute 'bdelete ' . t:git_vimdiff_buffers[0]
execute 'bdelete ' . t:git_vimdiff_buffers[1]
close
else
echohl Error
echo 'There still remains conflict'
echohl None
endif
endif
endfunction

function! s:OpenGitBuffer(content)
if exists('b:is_git_msg_buffer') && b:is_git_msg_buffer
enew!
Expand Down Expand Up @@ -180,5 +204,6 @@ command! GitStatus call GitStatus()
command! -nargs=? GitAdd call GitAdd(<q-args>)
command! GitLog call GitLog()
command! GitCommit call GitCommit()
command! GitVimDiffMerge call GitVimDiffMerge()
command! -nargs=+ Git call GitDoCommand(<q-args>)
command! GitVimDiffMerge call GitVimDiffMerge()
command! GitVimDiffMergeDone call GitVimDiffMergeDone()

0 comments on commit a7d32d1

Please sign in to comment.