 repository already exists, throw an error."
   (straight--with-plist recipe
       (type local-repo)
-    (let ((straight--default-directory (straight--repos-dir))
-          (commit nil))
+    (let ((straight--default-directory (straight--repos-dir)))
       (when (file-exists-p (straight--repos-dir local-repo))
         (error "Repository already exists: %S" local-repo))
       ;; We're reading the lockfiles inline here, instead of caching
       ;; them like we do with the build cache. The reason is that
       ;; reading the lockfiles appears to be much faster than reading
-      ;; the build cache, and also time is not really a concern if
-      ;; we're already going to be cloning a repository.
-      (dolist (spec straight-profiles)
-        (cl-destructuring-bind (_profile . versions-lockfile) spec
-          (let ((lockfile-path (straight--versions-file versions-lockfile)))
-            (when-let ((versions-alist (ignore-errors
-                                         (with-temp-buffer
-                                           (insert-file-contents-literally
-                                            lockfile-path)
-                                           (read (current-buffer))))))
-              (when-let ((frozen-commit
-                          (cdr (assoc local-repo versions-alist))))
-                (setq commit frozen-commit))))))
-      (straight-vc 'clone type recipe commit))))
+      ;; the build cache (and we wouldn't want to engage in premature
+      ;; optimization, now would we?), and also time is not really a
+      ;; concern if we're already going to be cloning a repository.
+      (let ((commit (cdr (assoc
+                          local-repo (straight--lockfile-read-all)))))
+        (straight-vc 'clone type recipe commit)))))
 
 (defun straight-vc-normalize (recipe)
   "Normalize the local repository specified by straight.el-style RECIPE.

(defun straight-thaw-versions ()
  "Read version lockfiles and restore package versions to those listed."
  (interactive)
  (let ((versions-alist (straight--get-versions)))
    (straight--map-repos-interactively
     (lambda (package)
       (let ((recipe (gethash package straight--recipe-cache)))

`straight-rebuild-package' or `straight-rebuild-all' is
invoked.")

;;;;; Interactive mapping

(cl-defun straight--map-repos-interactively (func &optional predicate action)
