about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2008-02-04 15:50:23 +0100
committerChristian Neukirchen <chneukirchen@gmail.com>2008-02-04 15:50:23 +0100
commit31660bd34441ccacfa28c57e1d5c39a2f6e9338e (patch)
tree5b8d51696f4038792458e9eb75faf2fe51e54b11
parent231e1b12819909d6c8cf633677eb9702e850cf92 (diff)
downloadgitsum-31660bd34441ccacfa28c57e1d5c39a2f6e9338e.tar.gz
gitsum-31660bd34441ccacfa28c57e1d5c39a2f6e9338e.tar.xz
gitsum-31660bd34441ccacfa28c57e1d5c39a2f6e9338e.zip
Remove git-diff crud that confuses diff-mode
-rw-r--r--gitsum.el8
1 files changed, 5 insertions, 3 deletions
diff --git a/gitsum.el b/gitsum.el
index d28e65e..91d0c61 100644
--- a/gitsum.el
+++ b/gitsum.el
@@ -37,6 +37,7 @@ This mode is meant to be activated by `M-x gitsum' or pressing `s' in git-status
 ;; Undo doesn't work in read-only buffers else.
 (defun gitsum-undo ()
   "Undo some previous changes.
+
 Repeat this command to undo more changes.
 A numeric argument serves as a repeat count."
   (interactive)
@@ -54,9 +55,10 @@ A numeric argument serves as a repeat count."
     (let ((diff (shell-command-to-string "git diff")))
       (if (zerop (length diff))
           (insert "## No changes. ##")
-        (insert diff)))
-    (set-buffer-modified-p nil)
-    (goto-char (point-min))))
+        (insert diff)
+        (goto-char (point-min))
+        (delete-matching-lines "^index \\|^diff --git ")))
+    (set-buffer-modified-p nil)))
 
 (defun gitsum-commit ()
   "Commit the patch as-is, asking for a commit message."