     (and (straight-vc-git--ensure-remotes recipe)
          (or (and (straight-vc-git--ensure-nothing-in-progress local-repo)
                   (straight-vc-git--ensure-worktree local-repo)
-                  (straight-vc-git--ensure-head
+                  (straight-vc-git--ensure-head-at-branch
                    local-repo
                    (or branch (straight-vc-git--default-remote-branch
                                remote local-repo))))

              (straight-vc-git--encode-url
               fork-repo fork-host fork-protocol))))))

;; The following handles only merges, not rebases. See
;; https://github.com/raxod502/straight.el/issues/271.
(defun straight-vc-git--ensure-nothing-in-progress (local-repo)
  "Ensure that no merge conflict is active in LOCAL-REPO.
LOCAL-REPO is a string."
  (let ((conflicted-files
         (string-remove-suffix
          "\n"
          (straight--process-output "git" "ls-files" "--unmerged"))))
    (or (string-empty-p conflicted-files)
        (ignore
         (straight-vc-git--popup
           (format "Repository %S has a merge conflict:\n%s"
                   local-repo
                   (straight--split-and-trim
                    conflicted-files 2))
           ("a" "Abort merge"
            (straight--process-output "git" "merge" "--abort")))))))

(cl-defun straight-vc-git--ensure-worktree (local-repo)
  "Ensure that LOCAL-REPO has a clean worktree.

                              remote local-repo))))
      (while t
        (and (straight-vc-git--ensure-local recipe)
             (or (straight-vc-git--ensure-default-branch-current
                  local-repo remote-branch
                  (format "%s/%s" remote remote-branch))
                 (straight-register-repo-modification local-repo))
