- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 934
python3 specific: seems to wipe out entire .git/config upon #333
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
Comments
gitpython-developers/GitPython#333 only under python3, so we will skip that test there for now
Unfortunately, this issue cannot be fixed on the side of GitPython. Back in the days, I wrote the code as if there were deterministic destructors, which seemed to be the case in py2.7. However, since py3, this clearly is not the case at all anymore, and one simply shouldn't use Code involving the writer now has to be written like so: writer = repo.config_writer()
writer.set_value('section', 'key', 'value')
writer.release() If that is not done, bad things can happen, even though I wouldn't know why it can also lead to a wiped configuration file as you describe it. As noted, you will have to change all code involving a Please let me know if this makes sense to you. |
Great -- thanks for the quick get back!
which would also release automatically whenever I leave the context |
I love the idea stated at 2), and believe this should have been the solution from the get-go. Probably I decided against it back in the days due to the performance implications, as I most certainly didn't think of introducing something like Currently I am totally unsure when I will find the state of mind to do this - you might be faster with a respective PR in case it's critical to you. |
;-) in my case it was a single use-case and I could easily fix it up Cheers! |
uff -- that is a nasty one ;) Our piece of code is
where backend is a str (python3). And it seems to set the value properly and actual wipe out of the file doesn't happen until this writer (I guess) gets GCed -- I force that in our test now with gc.collect() and it results then in .git/config of that repo being wiped (0 byte size).
I have upgraded even to current master in that tox env, and the same result. Let me know if you need more details. python is 3.4.3, Debian amd64 sid/testing
The text was updated successfully, but these errors were encountered: