@matheusbsbs / matheus-bagliano / commits / 09afcd6933
Fork 0

git.el: Add support for interactive diffs.

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

Alexandre Julliard committed Aug 11, 2007 at 12:22 UTC 09afcd6933e8497c997205dda71d718e62b4de62
1 file changed +7 -1
contrib/emacs/git.el
+7 -1
@@ -965,7 +965,13 @@ Return the list of files that haven't been handled."
965 (defun git-diff-file-idiff ()
966 "Perform an interactive diff on the current file."
967 (interactive)
968 - (error "Interactive diffs not implemented yet."))
968 + (let ((files (git-marked-files-state 'added 'deleted 'modified)))
969 + (unless (eq 1 (length files))
970 + (error "Cannot perform an interactive diff on multiple files."))
971 + (let* ((filename (car (git-get-filenames files)))
972 + (buff1 (find-file-noselect filename))
973 + (buff2 (git-run-command-buffer (concat filename ".~HEAD~") "cat-file" "blob" (concat "HEAD:" filename))))
974 + (ediff-buffers buff1 buff2))))
975
976 (defun git-log-file ()
977 "Display a log of changes to the marked file(s)."