Skip to content

Commit

Permalink
git-p4: fix freezing while waiting for fast-import progress
Browse files Browse the repository at this point in the history
As part of its importing process, git-p4 sends a `checkpoint` followed
immediately by `progress` to fast-import to force synchronization.
Due to buffering, it is possible for the `progress` command to not be
flushed before git-p4 begins 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>
Reviewed-by: Ben Keene <seraphire@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
yangskyboxlabs authored and gitster committed Jan 15, 2020
1 parent 50da1e7 commit 4294d74
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions git-p4.py
Original file line number Diff line number Diff line change
Expand Up @@ -2641,6 +2641,7 @@ def __init__(self):
def checkpoint(self):
self.gitStream.write("checkpoint\n\n")
self.gitStream.write("progress checkpoint\n\n")
self.gitStream.flush()
out = self.gitOutput.readline()
if self.verbose:
print("checkpoint finished: " + out)
Expand Down

0 comments on commit 4294d74

Please sign in to comment.