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

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

[elpa] externals/vc-got a2474a4 048/145: improve vc-got-dir-status-files


From: ELPA Syncer
Subject: [elpa] externals/vc-got a2474a4 048/145: improve vc-got-dir-status-files
Date: Thu, 9 Sep 2021 15:58:31 -0400 (EDT)

branch: externals/vc-got
commit a2474a45dd5b17500561db24bec5680ec7224737
Author: Omar Polo <op@omarpolo.com>
Commit: Omar Polo <op@omarpolo.com>

    improve vc-got-dir-status-files
    
    show also missing/deleted files in vc-dir.  This isn't perfect yet,
    because adding a temporary file and removing it will confuse the
    vc-dir buffer.
---
 vc-got.el | 36 +++++++++++++++---------------------
 1 file changed, 15 insertions(+), 21 deletions(-)

diff --git a/vc-got.el b/vc-got.el
index 0aa37df..bbbf7a1 100755
--- a/vc-got.el
+++ b/vc-got.el
@@ -372,27 +372,21 @@ DIR-OR-FILE."
 ;; (vc-got-state "/usr/ports/mystuff/non-existant")
 
 (defun vc-got-dir-status-files (dir files update-function)
-  (let* ((files (seq-filter (lambda (file)
-                              (and (not (string= file ".."))
-                                   (not (string= file "."))
-                                   (not (string= file ".got"))))
-                            (or files
-                                (directory-files dir))))
-         (statuses (vc-got--parse-status
-                    (apply #'vc-got--status dir files)))
-         (default-directory dir))
-    (cl-loop
-     with result = nil
-     for file in files
-     do (setq result
-              (cons
-               (if (file-directory-p file)
-                   (list file 'unregistered nil)
-                 (if-let (status (cdr (assoc file statuses #'string=)))
-                     (list file status nil)
-                   (list file 'up-to-date nil)))
-               result))
-     finally (funcall update-function result nil))))
+  (let ((fs (seq-filter (lambda (file)
+                          (and (not (string= file ".."))
+                               (not (string= file "."))
+                               (not (string= file ".got"))))
+                        (or files
+                            (directory-files dir)))))
+    (cl-loop with result = (mapcar (lambda (x)
+                                     (list (car x) (cdr x) nil))
+                                   (vc-got--parse-status
+                                    (apply #'vc-got--status dir files)))
+             for file in fs
+             do (unless (cadr (assoc file result #'string=))
+                  (cl-pushnew (list file 'up-to-date nil)
+                              result))
+             finally (funcall update-function result nil))))
 
 ;; (let ((dir "/usr/ports/mystuff"))
 ;;   (vc-got-dir-status-files dir nil (lambda (res _t)



reply via email to

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