aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorAlexandre Julliard <julliard@winehq.org>2007-01-26 11:57:50 +0100
committerJunio C Hamano <junkio@cox.net>2007-01-26 15:38:27 -0800
commit40d6dc0f9d4045d237f8334224777922789c6d04 (patch)
tree159905837b582fcba60b7acb9a5592ae568adf85 /contrib
parent7f9acb2a16473e5ba6d44231d2fc844ca8bb9817 (diff)
downloadgit-40d6dc0f9d4045d237f8334224777922789c6d04.tar.gz
git-40d6dc0f9d4045d237f8334224777922789c6d04.tar.xz
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>
Diffstat (limited to 'contrib')
-rw-r--r--contrib/emacs/vc-git.el32
1 files changed, 8 insertions, 24 deletions
diff --git a/contrib/emacs/vc-git.el b/contrib/emacs/vc-git.el
index 65c455006..e456ab971 100644
--- a/contrib/emacs/vc-git.el
+++ b/contrib/emacs/vc-git.el
@@ -53,10 +53,6 @@
(let ((name (file-relative-name file)))
(eq 0 (apply #'call-process "git" nil (get-buffer "*Messages") nil (append args (list name))))))
-(defun vc-git--run-command-out (output &rest args)
- "Run a git command, output to output."
- (eq 0 (apply #'call-process "git" nil output nil (append args))))
-
(defun vc-git-registered (file)
"Check whether FILE is registered with git."
(with-temp-buffer
@@ -125,26 +121,14 @@
(defun vc-git-checkout (file &optional editable rev destfile)
(if destfile
- (let ((mybuff (get-buffer-create "vc-git-checkout-tmp")))
- (let ((rv
- (vc-git--run-command-out
- mybuff "cat-file" "blob"
- (concat (or rev "HEAD")
- ":"
- (let ((output (vc-git--run-command-string
- (file-relative-name file)
- "ls-files" "--full-name")))
- (string-match "\\(.*\\)" output)
- (match-string 1 output))
- )))
- )
- (if rv
- (save-current-buffer
- (set-buffer mybuff)
- (set-visited-file-name destfile t)
- (save-buffer)
- )
- rv)))
+ (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)