GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Fix iter_change_type diff renamed property to prevent warning by kamilkrzyskow · Pull Request #1918 · gitpython-developers/GitPython Conversation
|
| elif change_type == "R" and diffidx.renamed: | |
| yield diffidx |
Given that the code wasn't reported yet, perhaps I'm doing something wrong using the iter_change_type and there are better ways 👀 I'm using a custom MkDocs hook to run GitPython and check for renames to automatically create redirects mappings for paths, and another plugin handles the redirect creation for the static pages.
Here is the line which triggered the warning
And the CI:
Warning
As this is a one line change, I took the liberty to omit setting up an environment and just used the GitHub GUI to make a small change.
I also didn't investigate deeper to check if the iter_change_type has any tests.
Thanks for your time ✌️
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Thanks a for investigating this issue!
Unfortunately, no existing test fails, showing wrong expectations, which means that it's entirely unclear what this change does. Since the diff-code is confusing enough as it is, any change must be accompanied by a test that protects it from regression and makes clear what the purpose of the change is.
Of course I understand that producing a test that fails without this change, ideally pushed in a commit before this one, is additional work, and it's understandable this request might go beyond what you can provide. If so, please feel free to close this PR, but otherwise, please do take your time, it's appreciated.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
OK, I expected this turn of events 😅, I'll see what I can do over the week. EDIT: Lines 102 to 128 in 14066e2
I'll hijack this loose rule and just add a test for lack of warnings when running the EDIT2: Or in this file https://github.com/gitpython-developers/GitPython/blob/main/test/deprecation/test_basic.py 👌 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks a lot, and please do! And maybe after doing that, putting matters into their own test won't be hard anymore, but if not, also no problem at all. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
There you go, I added the test to the other deprecation tests in |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
My apologies, I realize my mistake now! rename is deprecated and was used internally, even though renamed_file should be used.
I thought this change is a affecting the logic of the diff, even though it's not doing that at all.
🤦♂️
Oh well, thanks again for bearing with me here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| def test_diff_iter_change_type(diffs: "DiffIndex") -> None: | ||
| """The internal DiffIndex.iter_change_type function issues no deprecation warning.""" | ||
| with assert_no_deprecation_warning(): |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
There must have been a misunderstanding. It's not about deprecation warnings, it's about adding a test that fails without the change presented here, while making clear what the issue truly is.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.