X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=contrib%2Femacs%2Fvc-git.el;h=e456ab9712e0574c712e5f79b0dc55cac167d9b1;hb=f95c6780c244e90abf87222126ad3b4bb18a504e;hp=3eb4bd19e921f293f1ed1ab1fd1bcd9f78763c4c;hpb=d4ada4876d5ab7b271857917231f6006f2160bca;p=git.git diff --git a/contrib/emacs/vc-git.el b/contrib/emacs/vc-git.el index 3eb4bd19e..e456ab971 100644 --- a/contrib/emacs/vc-git.el +++ b/contrib/emacs/vc-git.el @@ -120,7 +120,16 @@ (vc-git--run-command file "commit" "-m" comment "--only" "--"))) (defun vc-git-checkout (file &optional editable rev destfile) - (vc-git--run-command file "checkout" (or rev "HEAD"))) + (if destfile + (let ((fullname (substring + (vc-git--run-command-string file "ls-files" "-z" "--full-name" "--") + 0 -1)) + (coding-system-for-read 'no-conversion) + (coding-system-for-write 'no-conversion)) + (with-temp-file destfile + (eq 0 (call-process "git" nil t nil "cat-file" "blob" + (concat (or rev "HEAD") ":" fullname))))) + (vc-git--run-command file "checkout" (or rev "HEAD")))) (defun vc-git-annotate-command (file buf &optional rev) ; FIXME: rev is ignored