                             ;; creating forks).
                             (format "https://github.com/%s.git" repo)
                             (format "git@github.com:%s.git" repo))))))
-                  (let ((valid-p (straight--validate-head-is-reachable
-                                  local-repo head remote-urls)))
-                    (if valid-p
+                  (if (straight--validate-head-is-reachable
+                       local-repo head remote-urls)
+                      (if (straight--working-directory-dirty-p
+                           local-repo)
+                          (straight--warn
+                           (concat "Repository %S has a dirty "
+                                   "working directory")
+                           local-repo)
                         (unless nomsg
                           (message "Package %S is all good" package))
-                      (straight--warn
-                       "HEAD of repository %S%s is not reachable from remote"
-                       local-repo
-                       (if-let ((branch (straight--get-branch)))
-                           (format " (on branch %S)" branch)
-                         "")))
-                    valid-p)
+                        t) ; the only path where the package is valid
+                    (straight--warn
+                     "HEAD of repository %S%s is not reachable from remote"
+                     local-repo
+                     (if-let ((branch (straight--get-branch)))
+                         (format " (on branch %S)" branch)
+                       "")))
                 (straight--warn "Repository %S uses non-Git fetcher `%S'"
                                 local-repo fetcher))
             (straight--warn "Repository %S has a detached HEAD" local-repo))

       (concat "Repository %S is not version-controlled with Git, "
               "cannot set HEAD")
       local-repo))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; Figuring out whether packages need to be rebuilt

      (user-error "No packages loaded"))
     ((zerop valid-repos)
      (unless nomsg
        (message "All %d packages have irreproducible configurations" total-repos)))
     ((= valid-repos total-repos)
      (unless nomsg
        (message "All %d packages have reproducible configurations" total-repos)))
     (t
      (unless nomsg
        (message "%d packages have reproducible configurations, %d packages do not"
                 valid-repos (- total-repos valid-repos)))))
    (= valid-repos total-repos)))

