From 2fcdd916b98a459ad10fc3c2fff2667b2d55d940 Mon Sep 17 00:00:00 2001 From: Marius Vollmer Date: Sun, 1 Mar 2009 20:57:24 +0200 Subject: [PATCH] Don't run shell for magit-file-lines. * magit.el (magit-file-lines): Read contents into temporary buffer and split into lines using split-string. --- magit.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/magit.el b/magit.el index c6aef01f..08837f9b 100644 --- a/magit.el +++ b/magit.el @@ -255,9 +255,13 @@ Many Magit faces inherit from this one by default." (magit-format-git-command fmt args))) (defun magit-file-lines (file) - (if (file-exists-p file) - (magit-shell-lines (magit-format-shell-command "cat %s" (list file))) - nil)) + (when (file-exists-p file) + (with-temp-buffer + (insert-file-contents file) + (let ((rev (nreverse (split-string (buffer-string) "\n")))) + (nreverse (if (equal (car rev) "") + (cdr rev) + rev)))))) (defun magit-concat-with-delim (delim seqs) (cond ((null seqs)