summaryrefslogtreecommitdiff
path: root/git-p4.py
diff options
context:
space:
mode:
authorLuke Diamand <luke@diamand.org>2020-01-29 11:12:41 +0000
committerJunio C Hamano <gitster@pobox.com>2020-01-30 12:20:57 -0800
commit837b3a6376804ec70b88f06c3f702a38c59196c3 (patch)
tree33e714c46354fc840dd5b6620b0e25da0932c97a /git-p4.py
parentc7a62075917b3340f908093f63f1161c44ed1475 (diff)
downloadgit-837b3a6376804ec70b88f06c3f702a38c59196c3.tar.gz
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>
Diffstat (limited to 'git-p4.py')
-rwxr-xr-xgit-p4.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/git-p4.py b/git-p4.py
index 40d9e7c594..23724defe8 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -3549,11 +3549,14 @@ class P4Sync(Command, P4UserMap):
self.gitError = self.importProcess.stderr
def closeStreams(self):
+ if self.gitStream is None:
+ return
self.gitStream.close()
if self.importProcess.wait() != 0:
die("fast-import failed: %s" % self.gitError.read())
self.gitOutput.close()
self.gitError.close()
+ self.gitStream = None
def run(self, args):
if self.importIntoRemotes: