git.el: Always set the current directory in the git-diff buffer.

This allows jumping to the correct file with the diff-mode commands.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Alexandre Julliard 2007-08-11 12:23:21 +02:00 committed by Junio C Hamano
parent 09afcd6933
commit 8fdc39729b

View File

@ -912,10 +912,12 @@ Return the list of files that haven't been handled."
(defun git-setup-diff-buffer (buffer)
"Setup a buffer for displaying a diff."
(with-current-buffer buffer
(diff-mode)
(goto-char (point-min))
(setq buffer-read-only t))
(let ((dir default-directory))
(with-current-buffer buffer
(diff-mode)
(goto-char (point-min))
(setq default-directory dir)
(setq buffer-read-only t)))
(display-buffer buffer)
(shrink-window-if-larger-than-buffer))