git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/3] git.el: Added a function to diff against the other heads in a merge.
@ 2006-03-19  9:06 Alexandre Julliard
  0 siblings, 0 replies; only message in thread
From: Alexandre Julliard @ 2006-03-19  9:06 UTC (permalink / raw)
  To: git

git-diff-file-merge-head generates a diff against the first merge
head, or with a prefix argument against the nth head. Bound to `d h'
by default.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>

---

 contrib/emacs/git.el |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

92478446cf5718ee76acaced75ff41416329a509
diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el
index 5496a1b..ebd00ef 100644
--- a/contrib/emacs/git.el
+++ b/contrib/emacs/git.el
@@ -767,6 +767,16 @@ The default is to fall back to the git r
     (git-setup-diff-buffer
      (apply #'git-run-command-buffer "*git-diff*" "diff-index" "-p" "-M" "HEAD" "--" (git-get-filenames files)))))
 
+(defun git-diff-file-merge-head (arg)
+  "Diff the marked file(s) against the first merge head (or the nth one with a numeric prefix)."
+  (interactive "p")
+  (let ((files (git-marked-files))
+        (merge-heads (git-get-merge-heads)))
+    (unless merge-heads (error "No merge in progress"))
+    (git-setup-diff-buffer
+     (apply #'git-run-command-buffer "*git-diff*" "diff-index" "-p" "-M"
+            (or (nth (1- arg) merge-heads) "HEAD") "--" (git-get-filenames files)))))
+
 (defun git-diff-unmerged-file (stage)
   "Diff the marked unmerged file(s) against the specified stage."
   (let ((files (git-marked-files)))
@@ -959,6 +969,7 @@ The default is to fall back to the git r
     (define-key diff-map "=" 'git-diff-file)
     (define-key diff-map "e" 'git-diff-file-idiff)
     (define-key diff-map "E" 'git-find-file-imerge)
+    (define-key diff-map "h" 'git-diff-file-merge-head)
     (define-key diff-map "m" 'git-diff-file-mine)
     (define-key diff-map "o" 'git-diff-file-other)
     (setq git-status-mode-map map)))
-- 
1.2.4.g9c5a7

-- 
Alexandre Julliard
julliard@winehq.org

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2006-03-19  9:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-19  9:06 [PATCH 3/3] git.el: Added a function to diff against the other heads in a merge Alexandre Julliard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).