# File lib/grit/git.rb, line 172 def apply_patch(head_sha, patch) git_index = create_tempfile('index', true) git_patch = create_tempfile('patch') File.open(git_patch, 'w+') { |f| f.print patch } raw_git("git read-tree #{head_sha} 2>/dev/null", git_index) (op, exit) = raw_git("git apply --cached < #{git_patch}", git_index) if exit == 0 return raw_git("git write-tree", git_index).first.chomp end false end