emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/git-commit 4eb7d242bd 2/4: Address 'safe' XR/Relint regexp


From: ELPA Syncer
Subject: [nongnu] elpa/git-commit 4eb7d242bd 2/4: Address 'safe' XR/Relint regexp linter warnings
Date: Tue, 15 Aug 2023 12:59:40 -0400 (EDT)

branch: elpa/git-commit
commit 4eb7d242bdc28710eebba1f0ce4d07dd0a33dbad
Author: Basil L. Contovounesios <contovob@tcd.ie>
Commit: Basil L. Contovounesios <contovob@tcd.ie>

    Address 'safe' XR/Relint regexp linter warnings
    
    These changes should either be equivalent to the old regexps,
    or clearly correct internal shortcomings of theirs.
    
    - Fix gratuitous or insufficient backslash escaping.
      In '[\[]' it is merely redundant, but in '[\\+]' it matches a
      literal backslash in addition to a plus.
    
    - Prefer \`..\' over ^..$ anchors in file name contexts.
---
 lisp/magit-extras.el   | 2 +-
 lisp/magit-notes.el    | 2 +-
 lisp/magit-process.el  | 4 ++--
 lisp/magit-remote.el   | 2 +-
 lisp/magit-sequence.el | 2 +-
 lisp/magit.el          | 2 +-
 6 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/lisp/magit-extras.el b/lisp/magit-extras.el
index fe0de3914b..3597f47de5 100644
--- a/lisp/magit-extras.el
+++ b/lisp/magit-extras.el
@@ -780,7 +780,7 @@ argument."
        (replace-regexp-in-string
         (format "^\\%c.*\n?" (if (< (prefix-numeric-value arg) 0) ?+ ?-))
         "")
-       (replace-regexp-in-string "^[ \\+\\-]" "")))
+       (replace-regexp-in-string "^[ +-]" "")))
     (deactivate-mark))
    ((use-region-p)
     (call-interactively #'copy-region-as-kill))
diff --git a/lisp/magit-notes.el b/lisp/magit-notes.el
index 7e4771d6b5..12bac89b16 100644
--- a/lisp/magit-notes.el
+++ b/lisp/magit-notes.el
@@ -63,7 +63,7 @@
 (defun magit-notes-merging-p ()
   (let ((dir (expand-file-name "NOTES_MERGE_WORKTREE" (magit-gitdir))))
     (and (file-directory-p dir)
-         (directory-files dir nil "^[^.]"))))
+         (directory-files dir nil "\\`[^.]"))))
 
 (transient-define-infix magit-core.notesRef ()
   :class 'magit--git-variable
diff --git a/lisp/magit-process.el b/lisp/magit-process.el
index 6afacf72f0..71498ff0a3 100644
--- a/lisp/magit-process.el
+++ b/lisp/magit-process.el
@@ -152,13 +152,13 @@ itself from the hook, to avoid further futile attempts."
                  (const :tag "Don't start a cache daemon" nil)))
 
 (defcustom magit-process-yes-or-no-prompt-regexp
-  (concat " [\[(]"
+  (concat " [([]"
           "\\([Yy]\\(?:es\\)?\\)"
           "[/|]"
           "\\([Nn]o?\\)"
           ;; OpenSSH v8 prints this.  See #3969.
           "\\(?:/\\[fingerprint\\]\\)?"
-          "[\])] ?[?:]? ?$")
+          "[])] ?[?:]? ?$")
   "Regexp matching Yes-or-No prompts of Git and its subprocesses."
   :package-version '(magit . "2.1.0")
   :group 'magit-process
diff --git a/lisp/magit-remote.el b/lisp/magit-remote.el
index b35d8f1076..5c4d64d72b 100644
--- a/lisp/magit-remote.el
+++ b/lisp/magit-remote.el
@@ -143,7 +143,7 @@ has to be used to view and change remote related variables."
     (when (equal (magit-get "remote.pushDefault") remote)
       (magit-set new-name "remote.pushDefault"))
     (dolist (var (magit-git-lines "config" "--name-only"
-                                  "--get-regexp" "^branch\.[^.]*\.pushRemote"
+                                  "--get-regexp" "^branch\\.[^.]*\\.pushRemote"
                                   (format "^%s$" remote)))
       (magit-call-git "config" (and (not new-name) "--unset") var new-name))))
 
diff --git a/lisp/magit-sequence.el b/lisp/magit-sequence.el
index 3c5f7ca971..2b210a5716 100644
--- a/lisp/magit-sequence.el
+++ b/lisp/magit-sequence.el
@@ -1034,7 +1034,7 @@ status buffer (i.e., the reverse of how they will be 
applied)."
 
 (defun magit-rebase-patches ()
   (directory-files (expand-file-name "rebase-apply" (magit-gitdir))
-                   t "^[0-9]\\{4\\}$"))
+                   t "\\`[0-9]\\{4\\}\\'"))
 
 (defun magit-sequence-insert-sequence (stop onto &optional orig)
   (let ((head (magit-rev-parse "HEAD")) done)
diff --git a/lisp/magit.el b/lisp/magit.el
index c8170f79bf..38bd291366 100644
--- a/lisp/magit.el
+++ b/lisp/magit.el
@@ -556,7 +556,7 @@ is run in the top-level directory of the current working 
tree."
 (defconst magit-font-lock-keywords
   (eval-when-compile
     `((,(concat "(\\(magit-define-section-jumper\\)\\_>"
-                "[ \t'\(]*"
+                "[ \t'(]*"
                 "\\(\\(?:\\sw\\|\\s_\\)+\\)?")
        (1 'font-lock-keyword-face)
        (2 'font-lock-function-name-face nil t))



reply via email to

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