git-p4: avoid leak of file handle when cloning
Spotted by Eric Sunshine: https://public-inbox.org/git/CAPig+cRx3hG64nuDie69o_gdX39F=sR6D8LyA7J1rCErgu0aMA@mail.gmail.com/ Signed-off-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Luke Diamand committed
Jan 30, 2020 at 11:50 UTC
43f33e492af65d008045ee0695d0f17434e8c3c9
1 file changed
+2
-1
git-p4.py
+2
-1
@@ -3563,7 +3563,8 @@ class P4Sync(Command, P4UserMap):
3563
changes = []
3564
3565
if len(self.changesFile) > 0:
3566
- output = open(self.changesFile).readlines()
3566
+ with open(self.changesFile) as f:
3567
+ output = f.readlines()
3568
changeSet = set()
3569
for line in output:
3570
changeSet.add(int(line))