motiejus/dotfiles

Unnamed repository; edit this file 'description' to name the repository.
git clone https://git.jakstys.lt/motiejus/dotfiles.git
Log | Tree | Refs | README | LICENSE

commit f772aba9aaf5ee0029516e4fa0152d43b0649606 (tree)
parent a646064433d7505870243f2f7ace6228c7c7b1fc
Author: Tim Pope <code@tpope.net>
Date:   Wed, 14 Oct 2009 22:30:36 -0400

Fix writing to stage when not the current buffer

Diffstat:
Mplugin/fugitive.vim | 8+++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim @@ -843,13 +843,15 @@ endfunction function! s:BufWriteIndexFile() let tmp = tempname() try + let path = matchstr(expand('<amatch>'),'//\d/\zs.*') + let stage = matchstr(expand('<amatch>'),'//\zs\d') silent execute 'write !'.s:repo().git_command('hash-object','-w','--stdin').' > '.tmp let sha1 = readfile(tmp)[0] - let old_mode = matchstr(s:repo().git_chomp('ls-files','--stage',s:buffer().path()),'^\d\+') + let old_mode = matchstr(s:repo().git_chomp('ls-files','--stage',path),'^\d\+') if old_mode == '' - let old_mode = executable(s:repo().tree(s:buffer().path())) ? '100755' : '100644' + let old_mode = executable(s:repo().tree(path)) ? '100755' : '100644' endif - let info = old_mode.' '.sha1.' '.s:buffer().commit()."\t".s:buffer().path() + let info = old_mode.' '.sha1.' '.stage."\t".path call writefile([info],tmp) let error = system(s:repo().git_command('update-index','--index-info').' < '.tmp) if v:shell_error == 0