     (let ((branch (or branch straight-vc-git-default-branch)))
       (while t
         (and (straight-vc-git--ensure-local recipe)
-             (straight-vc-git--ensure-head
-              local-repo branch (format "%s/%s" remote remote-branch))
+             (or (straight-vc-git--ensure-head
+                  local-repo branch (format "%s/%s" remote remote-branch))
+                 (straight-register-repo-modification local-repo))
              (cl-return-from straight-vc-git--merge-from-remote-raw t))))))
 
 (cl-defun straight-vc-git--pull-from-remote-raw (recipe remote remote-branch)

  "In LOCAL-REPO, check out COMMIT.
LOCAL-REPO is a string naming a local package repository. COMMIT
is a 40-character string identifying a Git commit."
  (while t
    (and (straight-vc-git--ensure-nothing-in-progress local-repo)
         (straight-vc-git--ensure-worktree local-repo)

      (local-repo branch)
    (let ((branch (or branch straight-vc-git-default-branch)))
      (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 local-repo branch))
               (straight-register-repo-modification local-repo))))))

;;;;;; API

