git.el: Always set the current directory in the git-diff buffer.
authorAlexandre Julliard <julliard@winehq.org>
Sat, 11 Aug 2007 10:23:21 +0000 (12:23 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 13 Aug 2007 19:58:38 +0000 (12:58 -0700)
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>
contrib/emacs/git.el

index 214b75cf93fa0375f99350c54b115a85442a310c..be44e06c452818651d57f07ebb1288e62680794f 100644 (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))