@matheusbsbs / matheus-bagliano / commits / 40d6dc0f9d
Fork 0

vc-git.el: Take into account the destination name in vc-checkout.

This is necessary for vc-version-other-window. Based on a patch by Sam Vilain <sam.vilain@catalyst.net.nz>. Currently, the vc-git-checkout function uses `git checkout' to fetch a file from the git repository to the working copy. However, it is completely ignoring the input argument that specifies the destination file. `git-checkout' does not support specifying this, so we have to use `git-cat-file', capture the output in a buffer and then save it. Signed-off-by: Alexandre Julliard <julliard@winehq.org> Signed-off-by: Junio C Hamano <junkio@cox.net>

Alexandre Julliard committed Jan 26, 2007 at 11:57 UTC 40d6dc0f9d4045d237f8334224777922789c6d04
1 file changed +8 -24
contrib/emacs/vc-git.el
+8 -24
@@ -53,10 +53,6 @@
53 (let ((name (file-relative-name file)))
54 (eq 0 (apply #'call-process "git" nil (get-buffer "*Messages") nil (append args (list name))))))
55
56 -(defun vc-git--run-command-out (output &rest args)
57 - "Run a git command, output to output."
58 - (eq 0 (apply #'call-process "git" nil output nil (append args))))
59 -
56 (defun vc-git-registered (file)
57 "Check whether FILE is registered with git."
58 (with-temp-buffer
@@ -125,26 +121,14 @@
121
122 (defun vc-git-checkout (file &optional editable rev destfile)
123 (if destfile
128 - (let ((mybuff (get-buffer-create "vc-git-checkout-tmp")))
129 - (let ((rv
130 - (vc-git--run-command-out
131 - mybuff "cat-file" "blob"
132 - (concat (or rev "HEAD")
133 - ":"
134 - (let ((output (vc-git--run-command-string
135 - (file-relative-name file)
136 - "ls-files" "--full-name")))
137 - (string-match "\\(.*\\)" output)
138 - (match-string 1 output))
139 - )))
140 - )
141 - (if rv
142 - (save-current-buffer
143 - (set-buffer mybuff)
144 - (set-visited-file-name destfile t)
145 - (save-buffer)
146 - )
147 - rv)))
124 + (let ((fullname (substring
125 + (vc-git--run-command-string file "ls-files" "-z" "--full-name" "--")
126 + 0 -1))
127 + (coding-system-for-read 'no-conversion)
128 + (coding-system-for-write 'no-conversion))
129 + (with-temp-file destfile
130 + (eq 0 (call-process "git" nil t nil "cat-file" "blob"
131 + (concat (or rev "HEAD") ":" fullname)))))
132 (vc-git--run-command file "checkout" (or rev "HEAD"))))
133
134 (defun vc-git-annotate-command (file buf &optional rev)