aboutsummaryrefslogtreecommitdiff
path: root/contrib/emacs/vc-git.el
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/emacs/vc-git.el')
-rw-r--r--contrib/emacs/vc-git.el11
1 files changed, 10 insertions, 1 deletions
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