1. Stefan Saasen
  2. git


Alexandre Julliard  committed 09afcd6

git.el: Add support for interactive diffs.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

  • Participants
  • Parent commits 04d70be
  • Branches master

Comments (0)

Files changed (1)

File contrib/emacs/git.el

View file
  • Ignore whitespace
 (defun git-diff-file-idiff ()
   "Perform an interactive diff on the current file."
-  (error "Interactive diffs not implemented yet."))
+  (let ((files (git-marked-files-state 'added 'deleted 'modified)))
+    (unless (eq 1 (length files))
+      (error "Cannot perform an interactive diff on multiple files."))
+    (let* ((filename (car (git-get-filenames files)))
+           (buff1 (find-file-noselect filename))
+           (buff2 (git-run-command-buffer (concat filename ".~HEAD~") "cat-file" "blob" (concat "HEAD:" filename))))
+      (ediff-buffers buff1 buff2))))
 (defun git-log-file ()
   "Display a log of changes to the marked file(s)."