microsoft / git

A fork of Git containing Microsoft-specific patches.
http://git-scm.com/
Other
782 stars 92 forks source link

checkout: ignore skip-worktree when virtual #658

Closed derrickstolee closed 4 months ago

derrickstolee commented 4 months ago

As documented in microsoft/vfsforgit#1812, attempting to restore a file fails when using either of these commands in a VFS for Git repo:

  git restore --source=<commit> <path>
  git checkout <commit> -- <path>

To discover the issue, I debugged such a call and found that since opt->ignore_skipworktree is not set, that the restore will not update the index when the file is not hydrated.

I verified that this works as expected, including that the file on-disk is projecting the new index version.