@matheusbsbs / matheus-bagliano / commits / 837b3a6376
Fork 0

git-p4: make closeStreams() idempotent

Ensure that we can safely call self.closeStreams() multiple times, and can also call it even if there is no git fast-import stream at all. Signed-off-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Luke Diamand committed Jan 29, 2020 at 11:12 UTC 837b3a6376804ec70b88f06c3f702a38c59196c3
1 file changed +3
git-p4.py
+3
@@ -3549,11 +3549,14 @@ class P4Sync(Command, P4UserMap):
3549 self.gitError = self.importProcess.stderr
3550
3551 def closeStreams(self):
3552 + if self.gitStream is None:
3553 + return
3554 self.gitStream.close()
3555 if self.importProcess.wait() != 0:
3556 die("fast-import failed: %s" % self.gitError.read())
3557 self.gitOutput.close()
3558 self.gitError.close()
3559 + self.gitStream = None
3560
3561 def run(self, args):
3562 if self.importIntoRemotes: