Don't Repeat Yourself (TM)
Signed-off-by: Pieter Praet <[email protected]>
---
magit.el | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/magit.el b/magit.el
index f1a1d31..1985988 100644
--- a/magit.el
+++ b/magit.el
@@ -4901,10 +4901,9 @@ (defun magit-rebase-info ()
(list
(magit-name-rev (magit-file-line (expand-file-name "onto" m)))
(length (magit-file-lines (expand-file-name "done" m)))
- (with-temp-buffer
- (insert-file-contents
- (expand-file-name "git-rebase-todo.backup" m))
- (cl-loop while (re-search-forward "^[^#\n]" nil t) count t))
+ (cl-loop for line in (magit-file-lines
+ (expand-file-name "git-rebase-todo.backup" m))
+ count (string-match "^[^#\n]" line))
(magit-file-line (expand-file-name "stopped-sha" m))))
((file-regular-p (expand-file-name "onto" a)) ; non-interactive
@@ -4912,12 +4911,10 @@ (defun magit-rebase-info ()
(magit-name-rev (magit-file-line (expand-file-name "onto" a)))
(1- (string-to-number (magit-file-line (expand-file-name "next" a))))
(string-to-number (magit-file-line (expand-file-name "last" a)))
- (with-temp-buffer
- (insert-file-contents
- (car (directory-files a t "^[0-9]\\{4\\}$")))
- (when (re-search-forward "^From \\([a-z0-9]\\{40\\}\\) "
- (line-end-position) t)
- (match-string 1))))))))
+ (let ((patch-header (magit-file-line
+ (car (directory-files a t "^[0-9]\\{4\\}$")))))
+ (when (string-match "^From \\([a-z0-9]\\{40\\}\\) " patch-header)
+ (match-string 1 patch-header))))))))
(defun magit-rebase-step ()
(interactive)
--
1.7.11.1
--
---
You received this message because you are subscribed to the Google Groups
"magit" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.