---
 magit.el |   21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/magit.el b/magit.el
index cac6d51..91a04c7 100644
--- a/magit.el
+++ b/magit.el
@@ -819,12 +819,14 @@ working directory state (or HEAD in a log buffer).  If 
it's a
 pair (START . END), then the range is START..END.")
 (make-variable-buffer-local 'magit-current-range)
 
-(defun magit-list-interesting-refs ()
+(defun magit-list-interesting-refs (&optional uninteresting)
   (let ((refs ()))
     (dolist (line (magit-git-lines "show-ref"))
       (if (string-match "[^ ]+ +\\(.*\\)" line)
          (let ((ref (match-string 1 line)))
-           (cond ((string-match "refs/heads/\\(.*\\)" ref)
+           (cond ((loop for i in uninteresting
+                         thereis (string-match i ref)))
+                  ((string-match "refs/heads/\\(.*\\)" ref)
                   (let ((branch (match-string 1 ref)))
                     (push (cons branch branch) refs)))
                  ((string-match "refs/tags/\\(.*\\)" ref)
@@ -844,13 +846,16 @@ pair (START . END), then the range is START..END.")
                                       (match-string 2 ref)))
                               ref)
                         refs))))))
-    refs))
+    (nreverse refs)))
 
-(defun magit-read-rev (prompt &optional def)
-  (let* ((prompt (if def
-                    (format "%s (default %s): " prompt def)
-                  (format "%s: " prompt)))
-        (interesting-refs (magit-list-interesting-refs))
+(defvar magit-uninteresting-refs '("refs/remotes/\\([^/]+\\)/HEAD$"))
+
+;; TODO: fix this so that def can (must?) be git rev instead of, say, "master 
(origin)"
+;; which involves a particular display strategy and shouldn't be visible to 
callers
+;; of magit-read-rev
+(defun magit-read-rev (prompt &optional def uninteresting)
+  (let* ((interesting-refs (magit-list-interesting-refs
+                            (or uninteresting magit-uninteresting-refs)))
         (reply (magit-completing-read prompt interesting-refs nil nil nil
                                        'magit-read-rev-history def))
         (rev (or (cdr (assoc reply interesting-refs)) reply)))
-- 
1.7.0.4


Reply via email to