commit - 8da4c01ab1701f49af2bb11b89698b2b3f839f1b
commit + 82289421895601458f16fa160107b9154be83342
blob - c36a3ac205cc753487ea6f60cb5b244967c12ec7
blob + 746bd0be40c5a89f5ec41c9a37e9b9747025ff01
--- vc-got.el
+++ vc-got.el
(vc-got--parse-status-flag (vc-got--status file))))
(defun vc-got-dir-status-files (dir files update-function)
- (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* ((fs (seq-filter (lambda (file)
+ (and (not (string= file ".."))
+ (not (string= file "."))
+ (not (string= file ".got"))))
+ (or files
+ (directory-files dir))))
+ (stats (vc-got--parse-status (apply #'vc-got--status dir files)))
+ (res))
+ ;; collect deleted and removed files
+ (cl-loop for (file . st) in stats
+ do (when (or (eq st 'missing)
+ (eq st 'removed))
+ (push (list file st nil) res)))
+ (cl-loop for file in fs
+ do (let ((s (if (file-directory-p file)
+ (list file 'unregistered nil)
+ (if-let (status (cdr (assoc file stats #'string=)))
+ (list file status nil)
+ ;; if file doesn't exists, it's a
+ ;; untracked file that was removed.
+ (when (file-exists-p file)
+ (list file 'up-to-date nil))))))
+ (when s
+ (push s res)))
+ finally (funcall update-function res nil))))
(defun vc-got-dir-extra-headers (_dir)
(concat