microsoft / microsoft/VFSForGit

git-apply doesn't work in VFS4G if files are not hydrated

Open
#1,108 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Copied from 924426 in the old Azure Repos backlog.

Steps to reproduce:

  1. Build a patch off any commit. Easiest way is to checkout a new branch off master in GVFS and make a change in a file, (e.g. Readme.md) then commit that change to a new branch. Generate the patch by running:
    git format-patch master --stdout > test.patch
  2. Clone a new enlistment of the GVFS repo to make sure all files are unhydrated.
  3. Apply the patch generated in (1) by running: git apply test.patch

Expected Behavior:

  1. The change to Readme.md is applied

Actual Behavior:
Git complains with "error: Readme.md: No such file or directory"

Note that using the --cached option for apply doesn't fix the problem since it does put the modifications in the index but then leaves the working directory with the previous file versions as unstaged changes. The patch will be successfully applied if you commit the changes in the index and then do a reset --hard.

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

Reproduce the issue in a fresh VFS4G/GVFS enlistment using the described branch, Readme.md change, test.patch, and git apply test.patch steps. Start by tracing how git apply handles an unhydrated Readme.md, then verify that applying the patch updates both the working directory and index without requiring a hard reset.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, git
Domain
operating-systems, tooling
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.