(defun vc-pijul-after-dir-status (root update-function files)
  "Function to run when the `vc-dir' buffer’s process is done.
For UPDATE-FUNCTION see vc.el comment section."
  (let* (result registered-and-not-up-to-date-files)
    (goto-char (point-min))
    (while (not (eobp))
      (when (looking-at (rx (group (one-or-more (any "A-Z")))
                            (one-or-more " ")
                            (group (one-or-more (not (any "\n "))))))
        (when-let ((file-state (vc-pijul--file-state root
                                 (match-string 2)
                                 (vc-pijul--state-code (match-string 1)))))
          (push file-state result)
          (push (seq-first file-state) registered-and-not-up-to-date-files)))
      (forward-line))
    (funcall update-function (nreverse result)
             (not (null (seq-difference
                         files registered-and-not-up-to-date-files))))
    (let* ((rest-files (seq-difference
                        files registered-and-not-up-to-date-files))
           (last (seq-first (last rest-files))))
      (seq-each (lambda (file)
                  (funcall
                   update-function
                   `((,file ,(if (vc-pijul-registered file)
                                 'up-to-date
                               'unregistered)
                            nil))
                   (unless (equal last file) t)))
                rest-files))))