-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Dirty submodules do not correctly appear in diffs #1684
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
Conversation
Interesting. This being a problem with caching of submodule data makes sense. When I was writing the submodule code, I was really worried that a lot of the operations were going to be expensive, so I built up a submodule list in memory and tried to store everything that we can discern about the submodules into that data structure. In retrospect, the design is too aggressive about keeping stuff in memory without having good controls to ensure things are synchronized with the disk. I'll see if I can make some contributions to this branch to get this on track... |
There was a bug where submodules whose HEAD had not been moved were being marked as having an UNMODIFIED delta record instead of being left MODIFIED. This fixes that and fixes the tests to notice if a submodule has been incorrectly marked as UNMODIFIED.
Ok, so the issue here was not that the test didn't look at the diff output of UNMODIFIED items; the issue in the tests was that those records should not have been UNMODIFIED and the tests didn't validate that there was no expected output for an UNMODIFIED record. I updated the tests with a somewhat different validation and fixed the problem that was incorrectly marking dirty submodules as UNMODIFIED. This facet of things doesn't really have anything to do with caching. When I reorganized the diff code recently, I moved the check that looked if a file was actually unmodified post data-load and accidentally made it too aggressive in clearing the MODIFIED state. That being said, I suspect there are still some issues with overly aggressive submodule caching and I'll keep looking at that. @jspahrsummers Do you want to get this fix merged ASAP or do you want to wait for me to add tests that try to show the submodule cache being used while invalid? |
Just a quick status update before I have to go offline for a couple hours. I've written an additional test that focuses on one submodule and makes a series of changes to the contents of that module while repeatedly diffing using various values with The one case where the cache seems to be screwing up is when I then generate a new commit from that updated index actually moving the HEAD of the submodule. It seems that we cache the old HEAD oid and don't pick up on the modification. I'm pretty sure I know a good way to fix this, but I haven't fixed it yet. I'm going to hold off on pushing my new failing test up here in case you decide you want to merge this PR that fixes the UNMODIFIED issue and have me deal with the caching issue in a separate PR. |
Awesome! Yeah, I'd love to get the diff fix in ASAP. The caching isn't as pressing right now. |
Okay, let's just merge this as a priority bug fix and I'll open a new PR with fixes for the caching stuff (which is going to be a much larger change to the test suite and more intrusive fix anyhow). |
Dirty submodules do not correctly appear in diffs
Dirty submodules do not correctly appear in diffs
@arrbee Looks like the
diff::submodules
tests were written to skip unmodified deltas, which is why we missed the bug with dirty submodule diffs.Calling
git_submodule_reload_all()
beforecheck_diff_patches()
seems to fix the failure in thedirty_submodule
test, but that begs a couple questions:Reloading does not fix the
submod2_index_to_wd
test. Not sure what the right answer is there.