-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
File replaced by other repository file does not show as changed #5132
Comments
When Git verifies that a file is up to date, it uses a couple of indicators for that, one of them being the "modified time". If it differs from what is recorded in the Git index, Git assumes that it needs to be refreshed, i.e. re-hashed. There are a couple of other bits and pieces of the metadata that are compared, and if all of them match, Git won't even look at the contents of the file but think that the Git index contains up to date information. I expect that this is where things go awry for you. The mtime probably matches, as does the ctime, as does the size (I suspect, but this is an educated guess). The only information that would help is the inode number, but Git for Windows does not use that information, for performance reasons (and nowadays also for backwards compatibility). Does the work-around to call |
Ok this is very interesting. And thanks a lot for enlightening me here. The workaround of calling Indeed the files only different by a number 1 being changed for a number 2, hence why the filesize also doesn't change. But I would still consider this a bug even if it is the end result of performance enhancements. |
It looks like even the mtime and ctime are identical, which makes this a problem. Granted, mtime and ctime are stored only with a 100 nanosecond granularity in NTFS, but still: It is a very narrow use case in which these can be identical as well as the file size. In #3707, I detailed a way out of this fix: If we manage to get the equivalent of Linux' inode numbers, then we can discern the files even in your use case. |
Would be great if we could get a fix like that in. For now the workaround at least provides a solution, but a proper fix would definitely make sense to keep others from falling into this arguably very specific pit of failure. |
The issue at hand is extremely puzzling to me. We're running multiple CI builds of one repository in parallel on a Windows machine.
During the CI build we are copying a different file (also part of the git repository) as a replacement over a file that is being tracked by git. When I do this the index shows no changes, even though the file contents are indeed different (verified by opening the file in a text editor).
The issue also seems to pop up when only a single CI build is being done once its been triggered once.
Multiple files are being copied the same way, but there is only one file for which this issue happens.
Running:
does not show the changes.
Running
shows that 0 paths were updated from the index.
Running
does not restore the original unchanged version of the file.
Deleting the file and running the either
checkout
orreset --hard
command restores the original version as expected.Deleting the index and recreating it shows the file as changed
Restarting the entire system does not show the file as changed. Changing
core.fscache
does nothing to mitigate this issue.Copying the directory to a different location shows the file as changed.
I am utterly lost on how to proceed on debugging this issue further. Any help would be very appreciated.
Setup
defaults?
to the issue you're seeing?
The machine in question is a CI runner that runs multiple builds in parallel on multiple copies of the same remote repository
Details
Bash
Minimal, Complete, and Verifiable example
this will help us understand the issue.
What did you expect to occur after running these commands?
Changed files are being shown
What actually happened instead?
One changed file is missing
If the problem was occurring with a specific repository, can you provide the
URL to that repository to help us with testing?
Unfortunately not as it is an internal repo
The text was updated successfully, but these errors were encountered: