microsoft / microsoft/VFSForGit

git checkout -- cannot restore deleted folders

Open
#286 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

affects: correctness affects: reliability type: bug
Dominant language
C#
Stars
6.1k
Forks
474
Avg merge
2d 4h
Merged PRs (30d)
8

Description

Repro:

M:\>gvfs clone https://gvfs.visualstudio.com/ci/_git/ForTests
M:\>cd ForTests\src
M:\ForTests\src>rmdir /s/q GVFS
M:\ForTests\src>git checkout -- GVFS
Unlink of file 'GVFS/FastFetch' failed. Should I try again? (y/n) n
warning: unable to unlink 'GVFS/FastFetch': Directory not empty
fatal: cannot create directory at 'GVFS/FastFetch': Directory not empty

M:\ForTests\src>

Ad this point git status shows all of the files as deleted, but they are being projected:

M:\ForTests\src>git status
On branch master
Your branch is up-to-date with 'origin/master'.

Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        deleted:    GVFS/FastFetch/App.config
        deleted:    GVFS/FastFetch/CheckoutFetchHelper.cs
<etc..>

M:\ForTests\src>dir GVFS\FastFetch
 Volume in drive M is Test SSD (on OS drive)
 Volume Serial Number is E25C-40BA

 Directory of M:\ForTests\src\GVFS\FastFetch

09/20/2018  01:23 PM    <DIR>          .
09/20/2018  01:23 PM    <DIR>          ..
09/20/2018  01:23 PM               187 App.config
09/20/2018  01:23 PM            10,382 CheckoutFetchHelper.cs
09/20/2018  01:23 PM             7,390 FastFetch.csproj
09/20/2018  01:23 PM            13,411 FastFetchVerb.cs
09/20/2018  01:23 PM            18,046 FetchHelper.cs
09/20/2018  01:23 PM    <DIR>          Git
09/20/2018  01:23 PM             1,470 GitEnlistment.cs
09/20/2018  01:23 PM             3,141 HashingStream.cs
09/20/2018  01:23 PM            29,264 Index.cs
09/20/2018  01:23 PM    <DIR>          Jobs
09/20/2018  01:23 PM               756 packages.config
09/20/2018  01:23 PM               653 PathConverter.cs
09/20/2018  01:23 PM               290 Program.cs
09/20/2018  01:23 PM    <DIR>          Properties
09/20/2018  01:23 PM             1,395 WorkingTree.cs
              12 File(s)         86,385 bytes
               5 Dir(s)  72,873,721,856 bytes free

M:\ForTests\src>

They appear to be projected because after unmounting they are gone:

M:\ForTests\src>gvfs unmount
Unmounting...Succeeded
Unregistering automount...Succeeded

M:\ForTests\src>dir GVFS\FastFetch
 Volume in drive M is Test SSD (on OS drive)
 Volume Serial Number is E25C-40BA

 Directory of M:\ForTests\src\GVFS\FastFetch

09/20/2018  01:23 PM    <DIR>          .
09/20/2018  01:23 PM    <DIR>          ..
               0 File(s)              0 bytes
               2 Dir(s)  72,873,832,448 bytes free

M:\ForTests\src>

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the listed gvfs clone, rmdir, git checkout, and unmount sequence on Windows, then inspect the VFSForGit working-tree behavior involved in restoring deleted folders. Done means checkout restores the projected files without the unlink or directory-creation failure, and the files remain correctly restored after unmounting.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, git
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.