-
-
Notifications
You must be signed in to change notification settings - Fork 349
fix(next_by_topology): Correct the commit iteration order #853
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
Iterating over `gix::revision::walk::Platform::all()` returns commits in the wrong order. The expected commit output order is the same as `git log --graph` ``` * 0a534f214a |\ | * ebcd820b65 | * b56e33210a | * 46ff9bbc93 | * 6db404e52d |/ * f79134e683 |\ | * 29daaad4ad |/ * dbeb4b38c9 |\ | * 2398fb5d9f | * c550167bec | * 8d6c064c26 ``` Similar iteration using `gix::traverse::Platform` without this patch ``` * 0a534f214a * f79134e683 | * ebcd820b65 * dbeb4b38c9 | * 29daaad4ad | * b56e33210a * 163f943697 | * 2398fb5d9f | * 46ff9bbc93 * 00f8b9701e * cca06c8bd7 | * c550167bec | * 6db404e52d | * 8d6c064c26 ```
Hmm, i run locally only the tests in |
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.
Thanks a lot for your help.
There are tests to validate iteration order and these are usually compared to git
at least by hand. If something isn't consistent, I believe you could validate the existing iteration order by comparing what's expected against what git
produces, and make adjustments if there is a mismatch.
If you are encountering a case where the order doesn't match, you could try to reproduce the issue in a test and then fix it.
If there is no time to tackle this, I'd prefer if you could close it and reopen once that changes. Thanks for your consideration. |
Sorry, I pushed this to the end of the workqueue. I will try to find time this weekend, if you don't see any changes here on Monday, feel free to close it. |
Closing as per our agreement, thanks for having let me know. |
I looked yesterday into it, and I'm not sure if the order of ids in your tests are wrong or i have some error in my thinking. I looked into the test I could just fix all the tests, but I want to be sure I don't have an error in my thinking. |
Despite the name Maybe a PR would be to rename the function to something that indicates which ordering is used? |
The dates of the commits are all the same. (Btw the next tests e.g. Screenshot of three invocations of
All three outputs are identical, but also differ from hardcoded test values. I'm confused. EDIT: It makes sense that they are all identical, because the commit dates are all the same... |
Even though I think that the implementation is correct, there definitely seems to be some digging to be done, probably along with improving the tests to provide slightly different times for each commit (there is a couple of tests doing this). After having worked on For now I don't have a strong incentive to work on it, but next time a feature relies on revision walking, I will definitely take a look as well. |
For my current use case I will be sorting by date to achieve the results I expect, so I can abandon my patched fork. Thank you for your help. |
I am taking a closer look at this now and upon inspection I think there is a lot off about the expectations, especially because they don't have a baseline at all. When done I'd expect it to be aligned with |
I have cleaned up the tests and added new ones and definitely confirm that topo-order is very different from what git does. The main difference seems to be that git somehow keeps commits together, whereas For now I didn't get to investigate how exactly git does its ordering, but I will eventually to see if it can be implemented without also querying the commit time. The idea is the Let's see. |
I solved the problem by improving the documentation and renaming It does turn out that what |
Iterating over
gix::revision::walk::Platform::all()
returns commits inthe wrong order.
The expected commit output order is the same as
git log --graph
Similar iteration using
gix::traverse::Platform
without this patch