branch: elpa/git-commit commit 52dbf27427494da042da2331066ef6910321fb80 Author: Basil L. Contovounesios <conto...@tcd.ie> Commit: Basil L. Contovounesios <conto...@tcd.ie>
Address 'unsafe' XR/Relint regexp linter warnings While these changes pacify the linter and should be improvements over the old regexps, they are user-facing and not 100% equivalent. - In magit-log-propertize-keywords, identify bracketed keywords as greedy stretches without any bracket, rather than non-greedy stretches without an opening bracket. This might be faster. - Avoid optional prefix (group 1) matching the empty string in magit-release-tag-regexp; instead, make the prefix nil on non-match. All existing uses handle "" and nil as equivalent. --- lisp/magit-log.el | 2 +- lisp/magit-tag.el | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/magit-log.el b/lisp/magit-log.el index 4968a0fe30..f217546ce8 100644 --- a/lisp/magit-log.el +++ b/lisp/magit-log.el @@ -1460,7 +1460,7 @@ Do not add this to a hook variable." (magit--put-face (match-beginning 0) (1- boundary) 'magit-keyword-squash msg)) (when magit-log-highlight-keywords - (while (string-match "\\[[^[]*?]" msg boundary) + (while (string-match "\\[[^][]*]" msg boundary) (setq boundary (match-end 0)) (magit--put-face (match-beginning 0) boundary 'magit-keyword msg)))) diff --git a/lisp/magit-tag.el b/lisp/magit-tag.el index 480083142b..b49e48b3cc 100644 --- a/lisp/magit-tag.el +++ b/lisp/magit-tag.el @@ -127,7 +127,7 @@ defaulting to the tag at point. See also `magit-release-tag-regexp'.") (defvar magit-release-tag-regexp "\\`\ -\\(?1:\\(?:v\\(?:ersion\\)?\\|r\\(?:elease\\)?\\)?[-_]?\\)?\ +\\(?1:\\(?:v\\(?:ersion\\)?\\|r\\(?:elease\\)?\\)[-_]?\\)?\ \\(?2:[0-9]+\\(?:\\.[0-9]+\\)*\ \\(?:-[a-zA-Z0-9-]+\\(?:\\.[a-zA-Z0-9-]+\\)*\\)?\\)\\'" "Regexp used by `magit-tag-release' to parse release tags.