]> git.eshelyaron.com Git - emacs.git/commitdiff
Inline sole call to vc-git--state-code
authorSean Whitton <spwhitton@spwhitton.name>
Sat, 7 Jun 2025 11:50:52 +0000 (12:50 +0100)
committerEshel Yaron <me@eshelyaron.com>
Sat, 7 Jun 2025 20:03:20 +0000 (22:03 +0200)
* lisp/vc/vc-git.el (vc-git--state-code): Delete.
(vc-git-after-dir-status-stage): Inline it here.

(cherry picked from commit 82109aa7261ef98f41201b775f92d50ab7a4e6bb)

lisp/vc/vc-git.el

index fe75bd60f88f775ce40061ddf2731e26fe087656..cdbf80ebaaf8f39c8d0139a48b443fbb4c707849 100644 (file)
@@ -314,15 +314,6 @@ Good example of file name that needs this: \"test[56].xx\".")
                (string= (substring str 0 (1+ (length name)))
                         (concat name "\0"))))))))
 
-(defun vc-git--state-code (code)
-  "Convert from a string to an added/deleted/modified state."
-  (pcase (string-to-char code)
-    (?M 'edited)
-    (?A 'added)
-    (?D 'removed)
-    (?U 'edited)     ;; FIXME
-    (?T 'edited)))   ;; FIXME
-
 (defvar vc-git--program-version nil)
 
 (connection-local-set-profile-variables
@@ -657,7 +648,7 @@ or an empty string if none."
                (state (or (match-string 4) (match-string 6)))
                (name (or (match-string 5) (match-string 7)))
                (new-name (match-string 8)))
-           (if new-name  ; Copy or rename.
+           (if new-name                 ; Copy or rename.
                (if (eq ?C (string-to-char state))
                    (vc-git-dir-status-update-file
                     git-state new-name 'added
@@ -671,7 +662,13 @@ or an empty string if none."
                   (vc-git-create-extra-fileinfo old-perm new-perm
                                                 'rename name)))
              (vc-git-dir-status-update-file
-              git-state name (vc-git--state-code state)
+              git-state name (pcase (string-to-char state)
+                               (?M 'edited)
+                               (?A 'added)
+                               (?C 'added)
+                               (?D 'removed)
+                               (?U 'edited)  ;; FIXME
+                               (?T 'edited)) ;; FIXME
               (vc-git-create-extra-fileinfo old-perm new-perm)))))))
     ;; If we had files but now we don't, it's time to stop.
     (when (and files (not (vc-git-dir-status-state->files git-state)))