Skip to content

Commit 0742b7c

Browse files
luked99gitster
authored andcommitted
git-p4: do not fail in verbose mode for missing 'fileSize' key
If deleting or moving a file, sometimes P4 doesn't report the file size. The code handles this just fine but some logging crashes. Stop this happening. There was some earlier discussion on the list about this: https://public-inbox.org/git/[email protected]/ Signed-off-by: Luke Diamand <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5a0cc8a commit 0742b7c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

git-p4.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2775,7 +2775,10 @@ def streamOneP4File(self, file, contents):
27752775
relPath = self.stripRepoPath(file['depotFile'], self.branchPrefixes)
27762776
relPath = self.encodeWithUTF8(relPath)
27772777
if verbose:
2778-
size = int(self.stream_file['fileSize'])
2778+
if 'fileSize' in self.stream_file:
2779+
size = int(self.stream_file['fileSize'])
2780+
else:
2781+
size = 0 # deleted files don't get a fileSize apparently
27792782
sys.stdout.write('\r%s --> %s (%i MB)\n' % (file['depotFile'], relPath, size/1024/1024))
27802783
sys.stdout.flush()
27812784

0 commit comments

Comments
 (0)