-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Sparse-checkout excluded files show as deleted in git status after some operations #811
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Is there any other information I can give to help debug this? I don't know where to start trying to look into the cause. :( |
I think I had something like this with SourceTree, although you've debugged it much better than I ever did: some (not all) files I had previously excluded via sparse checkout ended up being deleted in commits I made long after they'd been excluded. As in, folders containing them were not on my file system, that's how excluded they were :-) I don't know the exact version now; I'll check and add when I get to work. |
I just tried to reproduce this (with a patch on top of v2.12.0-rc2, see git/git@master...dscho:sparse-cherry-pick for details) and it seems that the bug miraculously went away. Could you verify my claim? (If you find that your original problem still persists, I would love to work with you to condense the MCVE into a test case in Git's regression test suite, which is the first step to get it fixed.) |
The issue persists. The original MCVE fails. Your simplified version does not run into the issue. https://gist.github.com/nallar/bb4e5d654c41302eb1b14855b1ba96a1 |
In what little time I had to look at this problem, I got the impression that this issue is not Windows-specific at all. And as the Git project is blessed with a lot more active contributors than the Git for Windows project, I recommend sending this report to the Git mailing list instead. Hopefully one of the bunch will jump on this issue and help you fix it. |
I reported this to the mailing list on 6 Apr 2017 and unfortunately got no response. |
@nallar sorry to hear that. In the meantime, one of my excellent colleagues worked on sparse checkouts, and came up with a couple of fixes. In particular, I think about: microsoft@d7afc82, microsoft@fc0a289, microsoft@2121831 and microsoft@d55c451. Could you maybe cherry-pick them into a local SDK and try whether any of them fix your problem? (I sadly am short on time, so it would be really helpful to try these patches and let me know whether they fix this ticket; I would then of course fast-track the relevant patches into Git for Windows.) |
I havent tested OP's repro steps, but on Ubuntu with Git 2.13.0 "git pull" on my sparse checkout still messes up and makes "git status" show that I deleted files that were not part of the sparse checkout in 2.13.0. |
@TomyLobo did you cherry-pick any of the commits I indicated, to see whether they fix anything for you? |
@dscho That was more than 2 months old at the time, I had simply assumed they had already hit mainline, and anyway, since I am using Linux, not Windows, I'm not sure how useful that would be :) I was merely mentioning it in order to highlight the fact that it's unfixed in upstream and maybe should be transported there, perhaps together with my comment, to indicate that there is an issue on Linux as well. |
I think it would be highly useful, as nothing in those patches should be specific to Windows. |
Just to clarify: if you test this on Linux, and verify that it fixes things, you help bump up the priority of submitting that patch upstream. The more you help, the more you get what you want. |
I just ran the MCVE again, and this seems to have been resolved in the meantime. |
Setup
output of
git version
as well.64 bit git for windows 2.9
edit: Still present in
2.9.2.windows.1
Which version of Windows are you running? 32-bit or 64-bit?
64-bit Windows 7
What options did you set as part of the installation? Or did you choose the
defaults?
Also tested with
preloadindex
andfscache
, with no change in the results.to the issue you're seeing?
I don't think so.
Details
Which terminal/shell are you running Git from? e.g Bash/CMD/PowerShell/other
Doesn't matter, git bash or cmd makes no difference.
What commands did you run to trigger this issue? If you can provide a
Minimal, Complete, and Verifiable example
this will help us understand the issue.
I have created an MCVE repository which can be checked out and used to replicate the issue.
Checkout the repository at: https://github.com/nallar/git-issue-sparse-checkout
What did you expect to occur after running these commands?
Cherry-picking a commit from another branch should not cause files excluded in the sparse checkout rules to be changed.
What actually happened instead?
For some reason, the skip-worktree flag gets unset on the file
excluded-folder/1.txt
causing this to show as deleted. Note that the file which broke is a file which was renamed in a commit on theother
branch, but was not renamed in the commit we actually cherry-picked.If the problem was occurring with a specific repository, can you provide the
URL to that repository to help us with testing?
https://github.com/nallar/git-issue-sparse-checkout
TL;DR
A file which is excluded by sparse-checkout will show up as deleted in git status after cherry-picking a commit from another branch if any prior commit in that branch renames the file.
The text was updated successfully, but these errors were encountered: