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

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

[nongnu] elpa/git-commit ea132a52c6 1/3: Make object name regular expres


From: ELPA Syncer
Subject: [nongnu] elpa/git-commit ea132a52c6 1/3: Make object name regular expressions compatible with SHA-256
Date: Sat, 29 Jan 2022 11:58:30 -0500 (EST)

branch: elpa/git-commit
commit ea132a52c6ed12f5e3acbd0dd99edf673a945d67
Author: Kyle Meyer <kyle@kyleam.com>
Commit: Kyle Meyer <kyle@kyleam.com>

    Make object name regular expressions compatible with SHA-256
    
    Git has gained experimental support for SHA-256 repositories.  Since
    v2.29.0, the default Git build enables the user to create a SHA-256
    repository with 'git init --object-format=sha256'.
    
    There are a handful of regular expressions in the code base that
    assume 40-character object names.  Make these spots compatible with
    the new 64-character names by updating them to match 40 or more
    characters.
    
    Re: #4516
---
 lisp/magit-bisect.el | 4 ++--
 lisp/magit-blame.el  | 4 ++--
 lisp/magit-diff.el   | 2 +-
 lisp/magit-git.el    | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/lisp/magit-bisect.el b/lisp/magit-bisect.el
index ff2a53b540..63de453204 100644
--- a/lisp/magit-bisect.el
+++ b/lisp/magit-bisect.el
@@ -250,7 +250,7 @@ bisect run'."
                       "It appears you have invoked `git bisect' from a shell."
                       "There is nothing wrong with that, we just cannot 
display"
                       "anything useful here.  Consult the shell output 
instead.")))
-           (done-re "^\\([a-z0-9]\\{40\\}\\) is the first bad commit$")
+           (done-re "^\\([a-z0-9]\\{40,\\}\\) is the first bad commit$")
            (bad-line (or (and (string-match done-re (car lines))
                               (pop lines))
                          (--first (string-match done-re it) lines))))
@@ -299,7 +299,7 @@ bisect run'."
                               (magit-abbrev-length)))
             (insert ?\n)))))
     (when (re-search-forward
-           "# first bad commit: \\[\\([a-z0-9]\\{40\\}\\)\\] [^\n]+\n" nil t)
+           "# first bad commit: \\[\\([a-z0-9]\\{40,\\}\\)\\] [^\n]+\n" nil t)
       (magit-bind-match-strings (hash) nil
         (magit-delete-match)
         (magit-insert-section (bisect-item)
diff --git a/lisp/magit-blame.el b/lisp/magit-blame.el
index 81c6219e26..357e112fd3 100644
--- a/lisp/magit-blame.el
+++ b/lisp/magit-blame.el
@@ -476,7 +476,7 @@ modes is toggled, then this mode also gets toggled 
automatically.
 
 (defun magit-blame--parse-chunk (type)
   (let (chunk revinfo)
-    (unless (looking-at "^\\(.\\{40\\}\\) \\([0-9]+\\) \\([0-9]+\\) 
\\([0-9]+\\)")
+    (unless (looking-at "^\\(.\\{40,\\}\\) \\([0-9]+\\) \\([0-9]+\\) 
\\([0-9]+\\)")
       (error "Blaming failed due to unexpected output: %s"
              (buffer-substring-no-properties (point) (line-end-position))))
     (with-slots (orig-rev orig-file prev-rev prev-file)
@@ -491,7 +491,7 @@ modes is toggled, then this mode also gets toggled 
automatically.
           (cond ((looking-at "^filename \\(.+\\)")
                  (setq done t)
                  (setf orig-file (magit-decode-git-path (match-string 1))))
-                ((looking-at "^previous \\(.\\{40\\}\\) \\(.+\\)")
+                ((looking-at "^previous \\(.\\{40,\\}\\) \\(.+\\)")
                  (setf prev-rev  (match-string 1))
                  (setf prev-file (magit-decode-git-path (match-string 2))))
                 ((looking-at "^\\([^ ]+\\) \\(.+\\)")
diff --git a/lisp/magit-diff.el b/lisp/magit-diff.el
index 06ed1f4c1a..9ed0ea4947 100644
--- a/lisp/magit-diff.el
+++ b/lisp/magit-diff.el
@@ -2221,7 +2221,7 @@ section or a child thereof."
                        ("removed in remote" "removed"))))
       (magit-delete-line)
       (while (looking-at
-              "^  \\([^ ]+\\) +[0-9]\\{6\\} \\([a-z0-9]\\{40\\}\\) \\(.+\\)$")
+              "^  \\([^ ]+\\) +[0-9]\\{6\\} \\([a-z0-9]\\{40,\\}\\) \\(.+\\)$")
         (magit-bind-match-strings (side _blob name) nil
           (pcase side
             ("result" (setq file name))
diff --git a/lisp/magit-git.el b/lisp/magit-git.el
index e45c0ad7ca..8692d92aae 100644
--- a/lisp/magit-git.el
+++ b/lisp/magit-git.el
@@ -1833,7 +1833,7 @@ SORTBY is a key or list of keys to pass to the `--sort' 
flag of
           (magit-git-lines "submodule" "status")))
 
 (defun magit-list-module-paths ()
-  (--mapcat (and (string-match "^160000 [0-9a-z]\\{40\\} 0\t\\(.+\\)$" it)
+  (--mapcat (and (string-match "^160000 [0-9a-z]\\{40,\\} 0\t\\(.+\\)$" it)
                  (list (match-string 1 it)))
             (magit-git-items "ls-files" "-z" "--stage")))
 



reply via email to

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