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
Regression, manually build tree is corrupt #2489
Comments
Does |
Yes:
|
Below the test code in C.
|
The bug is fixed in the master branch, apparently fixed by the work in the Now, this is in my opinion a serious enough bug to deserve a release. |
Yes it is. We'll ship a minor point release. |
I can reproduce here, and worryingly enough it seems to be related to using When using |
Is it just that the comparison function changes between what is used by |
We only have one comparison function, which is set at the beginning and (should be) used throughout. |
Shot in the dark here (didn't look at the code for this), does the comparison function satisfy "strict weak ordering" criteria? |
Creating a tree entry happens in two steps, first we allocate it, passing the filename so we can allocate enough space, and then we set the attributes and copy the id. In the current code we set the attributes together with the id after inserting into the vector. This lets us use the same two lines to prepare a new entry and to revive an deleted one (which we keep around because we may have returned a pointer to the user, even though now we're changing it from under them, but that's a different story). As we are now sorting on insert, we need to have the attributes correctly set, as the Git tree sorting order behaves as though tree entries had a trailing slash which is not in the entry's name. As we haven't set the entry to be a tree yet, we're sorting it as though it were a blob's name, leading to incorrect sorting. |
There's a fix in the |
The code below works with libgit2 0.20.0 but does not with 0.21.0
When I have time I will rewrite the test script to C (and test against a checkout of libgit2, right now pygit2 does not build against a checkout).
To test the script:
The test code does not touch
foo.txt
at all. The tree built manually is wrong.This is the script:
The text was updated successfully, but these errors were encountered: