emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/vc-git.el,v


From: Dan Nicolaescu
Subject: [Emacs-diffs] Changes to emacs/lisp/vc-git.el,v
Date: Mon, 24 Mar 2008 08:21:47 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Dan Nicolaescu <dann>   08/03/24 08:21:46

Index: vc-git.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/vc-git.el,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -b -r1.45 -r1.46
--- vc-git.el   22 Mar 2008 17:33:51 -0000      1.45
+++ vc-git.el   24 Mar 2008 08:21:42 -0000      1.46
@@ -141,14 +141,23 @@
                    (string= (substring str 0 (1+ (length name)))
                              (concat name "\0")))))))))
 
+(defun vc-git--state-code (code)
+  "Convert from a string to a added/deleted/modified state."
+  (case (string-to-char code)
+    (?M 'edited)
+    (?A 'added)
+    (?D 'removed)
+    (?U 'edited)     ;; FIXME
+    (?T 'edited)))   ;; FIXME
+
 (defun vc-git-state (file)
   "Git-specific version of `vc-state'."
   ;; FIXME: This can't set 'ignored yet
   (vc-git--call nil "add" "--refresh" "--" (file-relative-name file))
   (let ((diff (vc-git--run-command-string file "diff-index" "-z" "HEAD" "--")))
-    (if (and diff (string-match ":[0-7]\\{6\\} [0-7]\\{6\\} [0-9a-f]\\{40\\} 
[0-9a-f]\\{40\\} \\([ADMU]\\)\0[^\0]+\0"
+    (if (and diff (string-match ":[0-7]\\{6\\} [0-7]\\{6\\} [0-9a-f]\\{40\\} 
[0-9a-f]\\{40\\} \\([ADMUT]\\)\0[^\0]+\0"
                                 diff))
-       (if (string= (match-string 1 diff) "A") 'added 'edited)
+        (vc-git--state-code (match-string 1 diff))
       (if (vc-git--empty-db-p) 'added 'up-to-date))))
 
 (defun vc-git--ls-files-state (state &rest args)
@@ -216,12 +225,7 @@
          ":[0-7]\\{6\\} [0-7]\\{6\\} [0-9a-f]\\{40\\} [0-9a-f]\\{40\\} 
\\([ADMUT]\\)\0\\([^\0]+\\)\0"
          nil t 1)
     (let ((filename (match-string 2))
-         (status (case (string-to-char( match-string 1))
-                   (?M 'edited)
-                   (?A 'added)
-                   (?D 'removed)
-                   (?U 'edited)      ;; FIXME
-                   (?T 'edited))))   ;; FIXME
+         (status (vc-git--state-code (match-string 1))))
       (push (cons filename status) vc-git-status-result)))
   (erase-buffer)
   (vc-git-command (current-buffer) 'async nil "ls-files" "-z" "-o"




reply via email to

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