From 3e77accab9a5af59ac30adeee0730179cf41f28e Mon Sep 17 00:00:00 2001 From: Marius Vollmer Date: Mon, 27 Jul 2009 22:03:35 +0300 Subject: [PATCH] Document why empty diff sections are no problem. Remove debug output for numstat diffs. --- magit.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/magit.el b/magit.el index 55772f62..8bdbbbfb 100644 --- a/magit.el +++ b/magit.el @@ -1568,6 +1568,12 @@ Please see the manual for a complete description of Magit. (deleted (string-to-number (match-string 2))) (file (match-string-no-properties 3)) (magit-section-hidden-default magit-hide-diffs)) + ;; The 'diff' section that is created here will not work with + ;; magit-insert-diff-item-patch etc when we leave it empty. + ;; Luckily, numstat diffs are only produced for staged and + ;; unstaged changes, and we never call + ;; magit-insert-diff-item-patch on them. This is a bit + ;; brittle, of course. (magit-with-section file 'diff (delete-region (point) (+ (line-end-position) 1)) (if (or (not (magit-section-hidden magit-top-section)) @@ -1575,7 +1581,7 @@ Please see the manual for a complete description of Magit. (magit-insert-diff file) (magit-set-section-info (list 'modified file nil)) (magit-set-section-needs-refresh-on-show t) - (insert (format "\tModified %s (+%d -%d)\n" file added deleted)))) + (insert (format "\tModified %s\n" file)))) t) nil))