Subject: bug#40248: 27.0.90; Failure open .authinfo.gpg from Gnus

From: Juri Linkov <[email-masked]>
Date: Thu, 23 Jul 2020 03:20:44 +0300

>> That sounds like a very useful thing to have.  How do you make vc-mode
>> (etc) show both dates?
>
> You don't need to tell VC anything, just say in your ~/.gitconfig
>
>   [format]
> 	  pretty = fuller

This setting breaks vc-git-log-view-mode: typing 'D' in the log buffer
with "CommitDate" throws the error:

  fatal: bad revision 'Date'

This is because it searches for the commit number and finds "CommitDate"
as in this example:

  commit 365e01cc9f64ce6ca947ccfd8612d60763280a37
  CommitDate: 2020-01-01 00:59:52 +0000

The problem is that 'vc-git-log-view-mode' sets 'log-view-message-re'
to this regexp:

  "^commit *\\([0-9a-z]+\\)"

where "\\([0-9a-z]+\\)" matches "Date" in "CommitDate".

This patch fixes it, but I'm not sure if this is the correct regexp
for git commits:

diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 9b8151705f..2220a33188 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -1241,7 +1241,7 @@ vc-git-log-view-mode
   (set (make-local-variable 'log-view-message-re)
        (if (not (memq vc-log-view-type '(long log-search with-diff)))
 	   (cadr vc-git-root-log-format)
-	 "^commit *\\([0-9a-z]+\\)"))
+	 "^commit +\\([0-9a-z]+\\)"))
   ;; Allow expanding short log entries.
   (when (memq vc-log-view-type '(short log-outgoing log-incoming mergebase))
     (setq truncate-lines t)