-
Notifications
You must be signed in to change notification settings - Fork 2.5k
WIP - Unsymlinked #878
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
WIP - Unsymlinked #878
Conversation
On my amd64 VM, |
Igore that, I ran the wrong test ( Now properly: the test fails with |
@@ -88,7 +88,10 @@ int diff_line_fn( | |||
e->line_adds++; | |||
break; | |||
case GIT_DIFF_LINE_ADD_EOFNL: | |||
assert(0); | |||
/* | |||
* FIXME: What should we do with the following assertion |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This constant is deprecated, so it would be an error to return it. I thought assert(0)
wasn't a horrible solution, but it does probably need a comment explaining why.
Okay, I figured out the bug that is being shown the unit test... On platforms that don't have symlinks, if a tree or index is being diffed against the working directory and we see a symlink that has been converted into a regular file, then we ignore the fact that it was "converted" and keep it as a symlink. Of course, we should really only do this if the new file info is coming from the filesystem. Line 471-474 of /* on platforms with no symlinks, preserve mode of existing symlinks */
if (S_ISLNK(omode) && S_ISREG(nmode) &&
!(diff->diffcaps & GIT_DIFFCAPS_HAS_SYMLINKS) &&
new_iter->type == GIT_ITERATOR_WORKDIR)
nmode = omode; With that change, I think we should get consistent behavior across platforms. By the way, I think we only have to do this for comparison with the WORKDIR because of the |
In looking at PR #878, I found a few small bugs in the diff code, mostly related to work that can be avoided when processing tree- to-tree diffs that was always being carried out. This commit has some small fixes in it.
Okay, so @nulltoken I think I know what's going here except for the amd64 problem. When you don't run sandboxed, the "gitattributes" file is not renamed to ".gitattributes" and as a result there is no .gitattributes file and the file that should be treated as a binary file is not, hence the number of hunks and the number of additions don't match up. That is why the test values don't match expected. In going through this code, however, I found several small bugs in the diff code. One is the problem mentioned above that the platform-specific symlink capabilities are effecting tree-to-tree diffs which they should not do. Another was an unnecessary recomputation of SHAs for tree-to-tree diffs because of a bug that was clearing the "OID is valid" flag in the diff. Since those bug fixes are independent of this PR, I just put them all into 5fdc41e and pushed them to development. If you rebase this PR, then you'll get those fixes. Of course, they won't actually matter for the different values between sandboxed / not sandboxed because that depends on the worktree based renaming of "gitattributes". |
@arrbee I've rebased the PR and fixed the tests. Below, some things I'd like yo interest you in ;-)
|
@nulltoken Thanks! I will look into what's happening with the assert. I think I know what's happening, but I think we should probably be returning The Windows failure in that case is a little odd to me, but I suspect it is due to the path munging that our Windows implementation of |
Looking over the use of I think this is a) not tested much in the library, b) not activated in most cases because we try to skip this code on Windows usually. I think that's the issue in this case with diff output - because we copy the mode bits from the index, this is one of the few places where we ever try to invoke the Windows |
I've rebased this on top of development. |
Rebased on top of development.
|
Does this still happen? The diff code has probably gone though a couple of overhauls by now. |
This test is related to issue libgit2/libgit2sharp#196
@carlosmn: Rebased on latest tip. Still failing, but the error now originates back from
|
In looking at PR libgit2#878, I found a few small bugs in the diff code, mostly related to work that can be avoided when processing tree- to-tree diffs that was always being carried out. This commit has some small fixes in it.
Thanks for the unit test here - after digging in to this again, I notice that we shouldn't be trying to read a symlink here at all! MIgrated this over to #3498 |
This PR is something between a WIP and some R&D. It originates back to libgit2/libgit2sharp#196 and libgit2/libgit2sharp#201.
Curiously, it looks like the .Net tests pass on Mono, Windows x86 but fail on Windows amd64
This PR brings the C version of one of the .Net test in order to try to troubleshoot this at the libgit2 level.