aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl Wiberg <kha@treskal.com>2010-01-13 11:27:12 +0100
committerKarl Wiberg <kha@treskal.com>2010-01-22 14:58:34 +0100
commit015a6dfa9abb62f661e669e7d741d8ae9369f09f (patch)
treed6917d08435441428ab4ca33172d9acb78dbe589
parent2b03ee282071042cb251b5004eda2e8bc8ee20f9 (diff)
downloadstgit-015a6dfa9abb62f661e669e7d741d8ae9369f09f.tar.gz
stgit.el: Break out diff whitespace arg handling to separate function
Signed-off-by: Karl Wiberg <kha@treskal.com>
-rw-r--r--contrib/stgit.el11
1 files changed, 6 insertions, 5 deletions
diff --git a/contrib/stgit.el b/contrib/stgit.el
index f617e6d..9814e84 100644
--- a/contrib/stgit.el
+++ b/contrib/stgit.el
@@ -1718,16 +1718,17 @@ If PATCHSYM is a keyword, returns PATCHSYM unmodified."
(error "Cannot find commit id for %s" patchsym))
(match-string 1 result))))
+(defun stgit-whitespace-diff-arg (arg)
+ (when (numberp arg)
+ (cond ((> arg 4) "--ignore-all-space")
+ ((> arg 1) "--ignore-space-change"))))
+
(defun stgit-show-patch (unmerged-stage ignore-whitespace)
"Show the patch on the current line.
UNMERGED-STAGE is the argument to `git-diff' that that selects
which stage to diff against in the case of unmerged files."
- (let ((space-arg (when (numberp ignore-whitespace)
- (cond ((> ignore-whitespace 4)
- "--ignore-all-space")
- ((> ignore-whitespace 1)
- "--ignore-space-change"))))
+ (let ((space-arg (stgit-whitespace-diff-arg ignore-whitespace))
(patch-name (stgit-patch-name-at-point t)))
(stgit-capture-output "*StGit patch*"
(case (get-text-property (point) 'entry-type)