   (straight--with-plist recipe
       (package local-repo)
     (or (not (file-exists-p (straight--file "build" package)))
-        (let ((mtime (car (gethash package straight--build-cache))))
+        (let ((mtime (nth 0 (gethash package straight--build-cache))))
           (or (not mtime)
               (with-temp-buffer
                 (let ((default-directory (straight--dir "repos" local-repo)))
                   (call-process
                    "find" nil '(t t) nil
-                   "." "-name" ".git" "-o" "-newermt" mtime "-print")
+                   "." "-name" ".git" "-prune" "-o" "-newermt" mtime "-print")
                   (> (buffer-size) 0))))))))
+
+(defun straight--packages-might-be-modified-p ()
+  (let ((repos nil)
+        (args nil))
+    (maphash
+     (lambda (package build-info)
+       (cl-destructuring-bind (mtime dependencies local-repo) build-info
+         (unless (member local-repo repos)
+           (push local-repo repos)
+           (setq args (append (list "-o"
+                                    "-path"
+                                    (format "./%s/*" local-repo)
+                                    "-newermt"
+                                    mtime
+                                    "-print")
+                              args)))))
+     straight--build-cache)
+    (setq args (append (list "." "-depth" "2" "-name" ".git" "-prune")
+                       args))
+    (with-temp-buffer
+      (let ((default-directory (straight--dir "repos")))
+        (apply 'call-process "find" nil '(t t) nil args)
+        (> (buffer-size) 0)))))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;; Building packages


(defun straight--update-build-mtime (recipe)
  (straight--with-plist recipe
      (package)
    (let ((mtime (format-time-string "%FT%T%z")))
      (puthash package (cons mtime (cdr (gethash package
                                                 straight--build-cache)))
               straight--build-cache))))

(defun straight--build-package (recipe &optional interactive parent-recipe)
  (straight--with-plist recipe

                   (straight--process-dependencies
                    (read (current-buffer))))
               (error nil)))))
    (straight--insert 1 package dependencies straight--build-cache)))

(defun straight--get-dependencies (package)
  (nth 1 (gethash package straight--build-cache)))

(defun straight--generate-package-autoloads (recipe)
  (straight--with-plist recipe
