branch: scratch/gited
commit 17303e70939bdcb93b3dc46c3fa2f14046006411
Author: Tino Calancha <tino.calan...@gmail.com>
Commit: Tino Calancha <tino.calan...@gmail.com>

    Use taggerdate/taggername when listing tags
    
    * gited.el (gited-list-refs-format-command): Don't hardcode 
authordate/authorname.
    (gited--list-refs-format): New defun.
    (gited--fill-branch-alist): Use it.
    (gited-list-branches): Don't prune remote branches when `gited-ref-kind'
    is \"tags\".
---
 packages/gited/gited.el | 33 ++++++++++++++++++++-------------
 1 file changed, 20 insertions(+), 13 deletions(-)

diff --git a/packages/gited/gited.el b/packages/gited/gited.el
index 632c805..55ba8bd 100644
--- a/packages/gited/gited.el
+++ b/packages/gited/gited.el
@@ -10,9 +10,9 @@
 ;; Compatibility: GNU Emacs: 24.4
 ;; Version: 0.2.0
 ;; Package-Requires: ((emacs "24.4") (cl-lib "0.5"))
-;; Last-Updated: Thu Jun 08 12:55:11 JST 2017
+;; Last-Updated: Thu Jun 08 14:26:38 JST 2017
 ;;           By: calancha
-;;     Update #: 649
+;;     Update #: 650
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;
@@ -331,8 +331,7 @@ TITLE is the title of the last commit.")
 (put 'gited-bisect-buffer 'permanent-local t)
 
 (defvar gited-list-refs-format-command
-  '("for-each-ref" "--format='(%(authordate:raw) \
-\"%(refname:short)\" \"%(authorname)\")'" "refs/%s")
+  '("for-each-ref" "--format='(%%(%s:raw) \"%%(refname:short)\" \"%%(%s)\")'" 
"refs/%s")
   "Format strings to build a Git command to list references.")
 
 (defvar gited-date-regexp (concat "\\("
@@ -2420,15 +2419,23 @@ reach the beginning of the buffer."
   (gited--move-to-column col)
   (goto-char (next-single-property-change (point) 
'tabulated-list-column-name)))
 
+(defun gited--list-refs-format (pattern)
+  (let ((refs-fmt (append (butlast gited-list-refs-format-command)
+                          (list (format (car (last 
gited-list-refs-format-command))
+                                        (if pattern
+                                            (pcase pattern
+                                              ("local" "heads")
+                                              ("remote" "remotes")
+                                              (_ pattern))
+                                          "heads"))))))
+    (setf (cadr refs-fmt)
+          (format (cadr refs-fmt)
+                  (if (equal pattern "tags") "taggerdate" "authordate")
+                  (if (equal pattern "tags") "taggername" "authorname")))
+    refs-fmt))
+
 (defun gited--fill-branch-alist (&optional pattern)
-  (let* ((args (append (butlast gited-list-refs-format-command)
-                       (list (format (car (last 
gited-list-refs-format-command))
-                                     (if pattern
-                                         (pcase pattern
-                                           ("local" "heads")
-                                           ("remote" "remotes")
-                                           (_ pattern))
-                                       "heads")))))
+  (let* ((args (gited--list-refs-format pattern))
          (alist
           (with-temp-buffer
             (insert "(\n")
@@ -3211,7 +3218,7 @@ in the active region."
       (when (eq buffer-invisibility-spec t)
         (setq buffer-invisibility-spec (list t)))
       ;; Check if we must prune remotes.
-      (when (and (not (equal gited-ref-kind "local"))
+      (when (and (equal gited-ref-kind "remote")
                  (or (eq t gited-prune-remotes)
                      (and (eq 'daily gited-prune-remotes)
                           (or (not gited--last-remote-prune)

Reply via email to