emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 576fba5: Display shorter dates in Git annotate outp


From: Dmitry Gutov
Subject: [Emacs-diffs] master 576fba5: Display shorter dates in Git annotate output
Date: Sat, 16 May 2015 23:47:25 +0000

branch: master
commit 576fba5f58dd61163cf92a0c3f93859e047ecefd
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>

    Display shorter dates in Git annotate output
    
    * lisp/vc/vc-git.el (vc-git-annotate-command): Use the short date
    format (when not overridden with vc-git-annotate-switches).
    (vc-git-annotate-time): Support the short format, as well as ISO
    8601 that has been used until now (bug#5428).
---
 lisp/vc/vc-git.el |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 059f34e..cbf3da3 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -1054,17 +1054,19 @@ or BRANCH^ (where \"^\" can be repeated)."
 
 (defun vc-git-annotate-command (file buf &optional rev)
   (let ((name (file-relative-name file)))
-    (apply #'vc-git-command buf 'async nil "blame" "--date=iso"
+    (apply #'vc-git-command buf 'async nil "blame" "--date=short"
           (append (vc-switches 'git 'annotate)
                   (list rev "--" name)))))
 
 (declare-function vc-annotate-convert-time "vc-annotate" (&optional time))
 
 (defun vc-git-annotate-time ()
-  (and (re-search-forward "[0-9a-f]+[^()]+(.* 
\\([0-9]+\\)-\\([0-9]+\\)-\\([0-9]+\\) \\([0-9]+\\):\\([0-9]+\\):\\([0-9]+\\) 
\\([-+0-9]+\\) +[0-9]+) " nil t)
+  (and (re-search-forward 
"^[0-9a-f]+[^()]+(.*?\\([0-9]+\\)-\\([0-9]+\\)-\\([0-9]+\\) 
\\(:?\\([0-9]+\\):\\([0-9]+\\):\\([0-9]+\\) \\([-+0-9]+\\)\\)? *[0-9]+) " nil t)
        (vc-annotate-convert-time
         (apply #'encode-time (mapcar (lambda (match)
-                                       (string-to-number (match-string match)))
+                                       (if (match-beginning match)
+                                           (string-to-number (match-string 
match))
+                                         0))
                                      '(6 5 4 3 2 1 7))))))
 
 (defun vc-git-annotate-extract-revision-at-line ()



reply via email to

[Prev in Thread] Current Thread [Next in Thread]