branch: externals/vc-got
commit a2474a45dd5b17500561db24bec5680ec7224737
Author: Omar Polo <[email protected]>
Commit: Omar Polo <[email protected]>
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)