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: Fri, 21 Mar 2008 06:29:06 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Dan Nicolaescu <dann>   08/03/21 06:29:05

Index: vc-git.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/vc-git.el,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -b -r1.41 -r1.42
--- vc-git.el   21 Mar 2008 06:24:14 -0000      1.41
+++ vc-git.el   21 Mar 2008 06:29:03 -0000      1.42
@@ -207,19 +207,18 @@
       ;; fall back to the default VC representation
       (vc-default-dired-state-info 'Git file))))
 
-(defun vc-git-dir-status (dir update-function status-buffer)
-  "Return a list of conses (file . state) for DIR."
-  ;; Further things that would have to be fixed later:
-  ;; - support for an empty repository (with no initial commit)
-  ;; - how to handle unregistered directories
-  ;; - how to support vc-status on a subdir of the project tree
-  (with-current-buffer
-      (get-buffer-create
-       (expand-file-name " *VC-Git* tmp status" dir))
-    (cd dir)
-    (let (result)
-      (erase-buffer)
-      (vc-git-command (current-buffer) 0 nil "diff-index" "-z" "HEAD")
+;; Variable used to keep the intermediate results for vc-git-status.
+(defvar vc-git-status-result nil)
+
+(defun vc-git-after-dir-status-stage2 (update-function status-buffer)
+  (goto-char (point-min))
+  (while (re-search-forward "\\([^\0]*?\\)\0" nil t 1)
+    (push (cons (match-string 1) 'unregistered) vc-git-status-result))
+  (funcall update-function (nreverse vc-git-status-result) status-buffer)
+  ;; Remove the temporary buffer.
+  (kill-buffer (current-buffer)))
+
+(defun vc-git-after-dir-status-stage1 (update-function status-buffer)
       (goto-char (point-min))
       (while (re-search-forward
               ":[0-7]\\{6\\} [0-7]\\{6\\} [0-9a-f]\\{40\\} [0-9a-f]\\{40\\} 
\\([ADMUT]\\)\0\\([^\0]+\\)\0"
@@ -231,14 +230,28 @@
                         (?D 'removed)
                         (?U 'edited)    ;; FIXME
                         (?T 'edited)))) ;; FIXME
-          (push (cons filename status) result)))
+      (push (cons filename status) vc-git-status-result)))
       (erase-buffer)
-      (vc-git-command (current-buffer) 0 nil "ls-files" "-z" "-o"
+  (vc-git-command (current-buffer) 'async nil "ls-files" "-z" "-o"
                       "--directory" "--no-empty-directory" 
"--exclude-standard")
-      (goto-char (point-min))
-      (while (re-search-forward "\\([^\0]*?\\)\0" nil t 1)
-        (push (cons (match-string 1) 'unregistered) result))
-      (funcall update-function (nreverse result) status-buffer))
+  (vc-exec-after
+   `(vc-git-after-dir-status-stage2 (quote ,update-function) ,status-buffer)))
+
+(defun vc-git-dir-status (dir update-function status-buffer)
+  "Return a list of conses (file . state) for DIR."
+  ;; Further things that would have to be fixed later:
+  ;; - support for an empty repository (with no initial commit)
+  ;; - how to handle unregistered directories
+  ;; - how to support vc-status on a subdir of the project tree
+  (with-current-buffer
+      (get-buffer-create
+       (expand-file-name " *VC-Git* tmp status" dir))
+    (set (make-local-variable 'vc-git-status-result) nil)
+    (cd dir)
+    (erase-buffer)
+    (vc-git-command (current-buffer) 'async nil "diff-index" "-z" "HEAD")
+    (vc-exec-after
+     `(vc-git-after-dir-status-stage1 (quote ,update-function) ,status-buffer))
     (current-buffer)))
 
 ;;; STATE-CHANGING FUNCTIONS




reply via email to

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