chiark / gitweb /
stgit.el: Allow showing patch on Index and Work tree
authorGustav Hållberg <gustav@virtutech.com>
Thu, 30 Jul 2009 22:57:58 +0000 (00:57 +0200)
committerGustav Hållberg <gustav@virtutech.com>
Thu, 6 Aug 2009 20:49:07 +0000 (22:49 +0200)
Signed-off-by: Gustav Hållberg <gustav@virtutech.com>
contrib/stgit.el

index 944d01e6e58084750497b69878060b8720df624a..00e54d664502b530a649202061c3da64ec3758a6 100644 (file)
@@ -939,8 +939,15 @@ (defun stgit-show ()
                                 (list (stgit-file-file patched-file))))))
          (apply 'stgit-run-git "diff" args)))
       ('patch
-       (stgit-run "show" "-O" "--patch-with-stat" "-O" "-M"
-                  (stgit-patch-name-at-point)))
+       (let* ((patch-name (stgit-patch-name-at-point))
+              (patch-id (stgit-id patch-name)))
+         (if (or (eq patch-id :index) (eq patch-id :work))
+             (apply 'stgit-run-git "diff"
+                    (stgit-find-copies-harder-diff-arg)
+                    (and (eq patch-id :index)
+                         '("--cached")))
+           (stgit-run "show" "-O" "--patch-with-stat" "-O" "-M"
+                      (stgit-patch-name-at-point)))))
       (t
        (error "No patch or file at point")))
     (with-current-buffer standard-output