Repository navigation
Reading progress of Git operation using GitPython stuck (or not printing) #871
Description
Activity
Try an older version of git (v2.20.0) as in v2.21.0 of git they changed the output strings to allow for localization, and that's caused at least one bug, let's see if it caused others...
Reacted by Thomas JohannesmeyerI switched to both the default macOS Git
2.14.ishas well as2.20.1. Both versions are not getting stuck anymore. Yet there is still no progress being printed.I'll create stripped down script to check if I can reproduce it reliably.
Since I switched to the older Git version and later on reinstalled Git
2.21.0, the very same code does not get stuck anymore. I don't know what caused this hickup. I will keep an eye on it and let you know if I can reproduce this behaviour in the upcoming weeks.I solved the second problem of the progress not being logged though and have a proposal for an implementation-, or at least documentation-change:
If the git process finishes quickly, the
update()method will never be called. I expected it to be called at least once. May I suggest implementing an additional methoddid_finish(exit_code, message)to theRemoteProgressclass?This way we do not break existing implementations and keep the progress handling in one place. Yes, I could check if my
fetch()returned a string and know that way, the process is done, but it would be a lot nicer to implement, if theRemoteProgresssubclass would be able to handle this as well.Also a note within the documentation for
update()would be awesome: Maybe with a hint for developers to grab a large repository, and prepare it for a longer process:$ git reset --hard @~100 $ git remote remove origin $ git reflog expire --expire=now --all && git gc --prune=now --aggressive $ git remote add origin <url>
Perhaps update() should always be called at least once?
Reacted by Thomas JohannesmeyerI proposed a pull request in which I adapt the behaviour in a way, that
update()is called once, even when Git answers with= [up to date]. My project depending on GitPython has a deadline of ~6 weeks. Please let me know if this change will be implemented. So that I have time to adjust my planning. Thank you in advance!- ghost added a commit that references this issue
on Jul 20, 2019 - ghost added a commit that references this issue
on Jul 20, 2019 - ghost added a commit that references this issue
on Jul 20, 2019 still an issue...
Still an issue. Not stuck, but not printing, git [INFO] git version -> 0; stdout: 'git version 2.39.5 (Apple Git-154)'
I'm trying to access the progress of time consuming Git operations using GitPython. I tried the sample solution taken from the official documentation, and also tried passing in a method following the exact signature of the update method below. Everytime I call
fetch(),push(),pull()with the parameterprogress=<anything>, the programm is stuck and theupdatemethod does not get called. If I call those operations without setting theprogressparameter, it works flawlessly.$ git --versionis 2.21.0sys.stdout.flush()afterprint()does not help eitherassertto assure my repo objects are available and in the expected stateProgressPrinter()yields notNoneRemoteProgressand also the implementation (line 815) ofpush()and do not see a reason, why it would not continue executionProgressPrinterinstance and pass the assigned variable, the programm is not stuck anymore. Yet theupdate()method does not get called and no progress is printed:Core of my implementation:
And later on:
Any recommendations on how to investigate this problem furthermore? I've been debugging this for several days now and feel like I am missing something.