git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 3/4] git-blame.el: Allow displaying author/commit times

From
Michal Sojka <sojkam1@fel.cvut.cz>
Date
Jul 2, 2013, 17:34 UTC
Message-ID
<1372786477-13122-4-git-send-email-sojkam1@fel.cvut.cz>
In-Reply-To
<1372786477-13122-1-git-send-email-sojkam1@fel.cvut.cz>
Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
---
 contrib/emacs/git-blame.el | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
diff --git a/contrib/emacs/git-blame.el b/contrib/emacs/git-blame.el
index 573f408..5c8933e 100644
--- a/contrib/emacs/git-blame.el
+++ b/contrib/emacs/git-blame.el
@@ -110,8 +110,10 @@ mode. The format is passed to `format-spec' with the following format keys:
   %H - the full hash
   %a - the author name
   %A - the author email
+  %t - the author time (see `git-blame-time-format')
   %c - the committer name
   %C - the committer email
+  %T - the committer time (see `git-blame-time-format')
   %s - the commit summary
 "
   :group 'git-blame)
@@ -125,6 +127,14 @@ same length, i.e. the it causes the prefix to be either truncated
 or padded to 30 characters.
 "
   :group 'git-blame)
+
+(defcustom git-blame-time-format
+  "%Y-%m-%d"
+  "The format for date/time values. This format is passed to
+`format-time-string' function.
+"
+  :group 'git-blame)
+
 (defcustom git-blame-mouseover-format
   "%h %a %A: %s"
   "The format of the description shown when pointing at a line in
@@ -135,8 +145,10 @@ with the following format keys:
   %H - the full hash
   %a - the author name
   %A - the author email
+  %t - the author time (see `git-blame-time-format')
   %c - the committer name
   %C - the committer email
+  %T - the committer time (see `git-blame-time-format')
   %s - the commit summary
 "
   :group 'git-blame)
@@ -393,6 +405,9 @@ See also function `git-blame-mode'."
           (puthash hash info git-blame-cache)
           info))))
 
+(defun git-blame-format-time (seconds)
+  (format-time-string git-blame-time-format (seconds-to-time (string-to-number seconds))))
+
 (defun git-blame-create-overlay (info start-line num-lines)
   (with-current-buffer git-blame-file
     (save-excursion
@@ -408,8 +423,10 @@ See also function `git-blame-mode'."
                        (?H . ,hash)
                        (?a . ,(git-blame-get-info info 'author))
                        (?A . ,(git-blame-get-info info 'author-mail))
+                       (?t . ,(git-blame-format-time (git-blame-get-info info 'author-time)))
                        (?c . ,(git-blame-get-info info 'committer))
                        (?C . ,(git-blame-get-info info 'committer-mail))
+                       (?T . ,(git-blame-format-time (git-blame-get-info info 'committer-time)))
                        (?s . ,(git-blame-get-info info 'summary)))))
           (push ovl git-blame-overlays)
           (overlay-put ovl 'git-blame info)
-- 
1.8.3.1
Previous: Michal SojkaNext: Michal Sojka
Message 4 of 5 in “Emacs: git-blame.el fixes and enhancements”
  1. 0/4 Emacs: git-blame.el fixes and enhancementsMichal Sojka, Jul 2, 2013
  2. 1/4 git-blame.el: Fix buffer local declarationMichal Sojka, Jul 2, 2013
  3. 2/4 git-blame.el: Make all line prefixes to have the same lengthMichal Sojka, Jul 2, 2013
  4. 3/4 git-blame.el: Allow displaying author/commit timesMichal Sojka, Jul 2, 2013
  5. 4/4 git-blame.el: Change the default prefix formatMichal Sojka, Jul 2, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.