-
-
Notifications
You must be signed in to change notification settings - Fork 906
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
Status of Tree.cache and TreeModifier is unclear #1771
Comments
Thanks for bringing this up. Since I don't have any knowledge anymore about this implementation except that it is most likely incorrect and should rather not be used for anything serious, what's left to discuss, I presume, is if code should be deprecated so it can eventually be removed. Maybe it would be worth trying to find it if it is usable for something after all (are there no tests for this?), or one could pre-emptively deprecate it to see if an outcry follows. In general, I'd always be for removing code, especially if its effectiveness is unclear, but I'd also not want to risk breakage in case we are missing something. As always, I'd rely on your expertise and analysis, with a strong slant towards following your suggestions. |
Currently there are no tests, as they were removed in b295c13, which possibly was also intended to remove the code under test, I am not sure. Some of that test code could potentially be brought back in some capacity (or just experimented with on a feature branch to try and figure out what, if anything, This is not necessarily the most important aspect of the situation, but if people are using this, and using it with a lot of data, then a possible benefit of replacing the hand-rolled mergesort implementation with a call to Lines 126 to 135 in f55d194
Anyway, I don't propose that any such change be rushed into. |
In b295c13, this was added to the changelog:
That commit was referenced in closing #369. Recently, work picked back up on this in #1799, which changed the sorting to use a custom key selector function that performs the comparison in a different way. Since then, this issue is out of date, but I am unsure if it is fully fixed. I think the the point for this issue, and for improving documentation of
What is the reason that was the case, and is it not still the case? |
Unfortunately, I don't know and assume the git commit log also doesn't clarify it. I don't believe it's impossible either, but also don't believe that these facilities should be used - I think they can't be trusted and using them may proliferate subtle or (hopefully) less subtle breakage in git data structures when written to the object database. If they were to be fixed, I'd probably focus on what GitPython was originally meant to be, that is a wrapper around the With all that said, it's probably still unclear what to do here, apologies :/. |
I've read the previous codes and docs before 1.0.2 - Fixes |
I am sorry, my memory has eroded over the last decade. However, the code in question should have tests which might make matters clearer. If there are no tests, then I think it's best to deprecate and discourage usage entirely, as I also think it's not really worth spending time on. |
Note: This bug seems either mitigated or fixed in #1799, and the writeup here does not reflect those changes.
In b295c13,
Tree.cache
was documented inCHANGES.rst
as removed, based on the discovery in #369 that it could not serve its originally intended purpose. ButTree.cache
, and its supporting code such as theTreeModifier
class, were not removed. They remain part of the public interface, are not indicated as deprecated, and nothing in any docstrings counsels against their use.I am unsure, based on this, if there is any reasonable use of them. My guess is that they may have been retained so that code that calls them without relying on the effect would not be broken, but I am not sure. If that is the case, it could be documented,
DeprecationWarning
s could be raised, and some of the non-public code may be possible to remove.For example, even if
TreeModifier.set_done
needs to perform the sort, and do so with exactly the current effect, both thegit_cmp
andmerge_sort
functions could probably be eliminated entirely, since they were introduced to do something that was cumbersome (at least at the time, supporting Python 2 and 3) with thelist.sort
method. But this is no longer the case ever since 4f1110b. If I understand, this change made it no longer sort longer sequences first:The text was updated successfully, but these errors were encountered: