-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Clarify behavior of index/workdir operations on a case insensitive platforms #1689
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
/cc @arrbee |
Of course, in order to see the failure, this has to be run on a Windows box ;-) |
I haven't had a chance to run this yet, by I think that:
at the end of the new test should actually fail. Based on some other failing tests that @ethomson wrote in 1540b19 we intentionally changed the behavior of tree-to-index comparisons so that they would always be case sensitive. If the tree contains "new_file" and the index contains "NEW_FILE" then those should be treated the same even on a case insensitive platform - only the filesystem is case-insensitive, not the actual data in the index. However, you point out an interesting dilemma. Although tree-to-index comparisons should be done case sensitively, pathspecs should probably be applied case insensitively for filtering purposes on platforms where the filesystem itself is case insensitive. This suggests that the fix for @ethomson's use case that I wrote in eefef64 is probably the wrong approach. I think on a case-insensitive filesystem, the traversal of the tree and index still need to be done with case-insensitive ordering (or actually semi-case-insensitive - "FILE" should still sort before "file"), but using case-sensitive filename comparison to decide what the true deltas are. Ugh, That is a mess because the case-insensitive tree and index iterators currently collapse a sequence of case-mismatched entries into a single albeit conflicted entry. That behavior is actually important for checkout where these multiple files are going to get mapped onto one another. Hmm. contemplation commences For the time being, I think applying pathspecs case-sensitively seems like the least bad thing to break of the many pieces that can be broken here. I'll need to think more about how to get all scenarios unbroken. |
@arrbee Thanks for your answer. That indeed makes sense. Playing a bit further with this, it looks like git.git isn't that case insensitive on Windows. git-status
git-add
|
Closing this, as there's no need to keep the issue open any longer. 1ec680b may be worth cherry-picking, though. |
I think I'm a bit lost. What would be the expected status then? We currently get |
Actually reopening this issue and giving it a more meaningful name |
I'm starting to wonder if we shouldn't try and mimic git.git... Indeed this might be a bit confusing to expose a different behavior depending whether the file actually exists or not in the index. Indeed, @yorah's right.
Beside this, I think I've found a bug: When |
Sorry to spam, but after stepping through the code, did you mean "... then those should not be treated the same ..." ? |
Okay. This is a mess. Thanks for teasing out all the subtle points! Let's talk about some of the cases:
|
I think I have come up with reasonable short-term and long-term solutions for this issue - not that I've coded the solution, but I have a plan. Let me write up my thoughts here and see if you think that it will work. I'd really appreciate some feedback! Short Term
Long Term
I'm pretty pleased about the idea of distinguishing iteration order from filename comparison and how it can resolve this situation. The basics of doing so are already present in the iterator code, so I don't think it will be too disruptive to add this capability and have a more elegant solution for this problem. And the short term fixes are something that I can probably knock out over the next week if we think they are worth addressing. Please let me know what you think! |
Sorry for letting this thread sleep, especially after the time you took to write your explanation and proposals.
I like the predictability of that solution. And from what I understand, it would simplify things a lot? |
@arrbee I like the idea of providing a "better" service than git.git. However, I think that in this particular case I'd indeed prefer to rely on a case sensitive pattern matching behavior. As we're going to store tree entries in a case insensitive container, I'd prefer to be picky regarding what we accept. I have the feeling that dealing with the platform preferred case handling in one tree, whereas we're case insensitive in the two others may turn into a gigantic magnet for corner-case issues. Maybe am I not seeing the bigger picture, but I can't think of real life use cases when we would need a case insensitive pattern matching behavior. |
Bump. My 2¢: it's not unreasonable for libgit2 to require the correct case when given a path. The internal representation is case-sensitive, we shouldn't hide that. Also, I don't want to think about But I'm no expert, and I certainly haven't thought about this as much as @arrbee has. |
It's been 1.5 years since anybody last thought about this and we've had a lot of case insensitive changes since then to better match git.git. @nulltoken is there still some unit test in LibGit2Sharp that is failing? Or some other behavior that we think maybe incorrect? |
@ethomson I believe those may be more or less related to this case sensitivity concern: |
Looking at the totality of this, and the issues (here and in LibGit2Sharp) that are now closed, I think that these are mostly resolved. If there are other, small, specific issues that I've missed then we should raise those separately. |
This LibGit2Sharp test doesn't pass any longer when being run against f2c4188.
The failing test has been stripped down to put this issue under the bright light of Clar.