diff mbox series

[09/13] git-p4: fix freezing while waiting for fast-import progress

Message ID 20191207003333.3228-12-yang.zhao@skyboxlabs.com
State New, archived
Headers show
Series git-p4: python3 compatibility | expand

Commit Message

Yang Zhao Dec. 7, 2019, 12:33 a.m. UTC
As part of its importing process, git-p4 sends a `checkpoint` followed
immediately by `progress` to fast-import in to force synchronization.
Due to buffering, it is possible for the `progress` command to not be
flushed before git-p4 proceeds to wait for the corresponding response.
This causes the script to freeze completely, and is consistently
observable at least on python-3.6.9.

Make sure this command sequence is completely flushed before waiting.

Signed-off-by: Yang Zhao <yang.zhao@skyboxlabs.com>
 git-p4.py | 1 +
 1 file changed, 1 insertion(+)
diff mbox series


diff --git a/git-p4.py b/git-p4.py
index c2a3de59e7..1007b936c8 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -2659,6 +2659,7 @@  def __init__(self):
     def checkpoint(self):
         self.gitStream.write("progress checkpoint\n\n")
+        self.gitStream.flush()
         out = self.gitOutput.readline()
         if self.verbose:
             print("checkpoint finished: " + out)