aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/vc
diff options
context:
space:
mode:
authorBasil L. Contovounesios2023-06-12 00:23:56 +0100
committerBasil L. Contovounesios2023-06-17 16:36:27 +0100
commitfef27d28fa70b52b6dc302d0b3ae1687499dd499 (patch)
treeedba954a9134bc55d4fc0f1bdac2e3b8d3c1507c /lisp/vc
parentf47cf7110edf94b7fb7c7a5ffa97e817f7a0e9d1 (diff)
downloademacs-fef27d28fa70b52b6dc302d0b3ae1687499dd499.tar.gz
emacs-fef27d28fa70b52b6dc302d0b3ae1687499dd499.zip
Fix more shy group regexps
These issues were caught by modified versions of the GNU ELPA packages xr and relint: - https://github.com/mattiase/xr/pull/6 - https://github.com/mattiase/relint/pull/14 * lisp/gnus/gnus-art.el (gnus-parse-news-url): Remove redundant numbered group and calls to match-string. * lisp/progmodes/c-ts-mode.el (c-ts-mode--c-or-c++-regexp): Fix shy group mistyped as optional colon (bug#64019#29). * lisp/vc/vc-git.el (vc-git-annotate-time): Ditto. Also fix timezone parsing by using iso8601-parse (bug#64069). * test/lisp/vc/vc-git-tests.el (vc-git-test-annotate-time): New test.
Diffstat (limited to 'lisp/vc')
-rw-r--r--lisp/vc/vc-git.el19
1 files changed, 12 insertions, 7 deletions
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index a3469b71386..dfca944dc74 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -1723,14 +1723,19 @@ This requires git 1.8.4 or later, for the \"-L\" option of \"git log\"."
1723 1723
1724(declare-function vc-annotate-convert-time "vc-annotate" (&optional time)) 1724(declare-function vc-annotate-convert-time "vc-annotate" (&optional time))
1725 1725
1726(autoload 'decoded-time-set-defaults "time-date")
1727(autoload 'iso8601-parse "iso8601")
1728
1726(defun vc-git-annotate-time () 1729(defun vc-git-annotate-time ()
1727 (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) 1730 (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)
1728 (vc-annotate-convert-time 1731 (let* ((dt (match-string 1))
1729 (apply #'encode-time (mapcar (lambda (match) 1732 (dt (if (not (match-beginning 2)) dt
1730 (if (match-beginning match) 1733 ;; Format as ISO 8601.
1731 (string-to-number (match-string match)) 1734 (concat dt "T" (match-string 2) (match-string 3))))
1732 0)) 1735 (decoded (ignore-errors (iso8601-parse dt))))
1733 '(6 5 4 3 2 1 7)))))) 1736 (and decoded
1737 (vc-annotate-convert-time
1738 (encode-time (decoded-time-set-defaults decoded)))))))
1734 1739
1735(defun vc-git-annotate-extract-revision-at-line () 1740(defun vc-git-annotate-extract-revision-at-line ()
1736 (save-excursion 1741 (save-excursion