From f5759238e10c64889187214401b24cf028f9d3a6 Mon Sep 17 00:00:00 2001 From: Jed Brown Date: Sun, 20 Jan 2013 19:54:26 -0600 Subject: filter-clean: fix for zero-length files causing early StopIteration --- git-fat | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'git-fat') diff --git a/git-fat b/git-fat index bdacd4e..c1f8ed6 100755 --- a/git-fat +++ b/git-fat @@ -144,15 +144,13 @@ class GitFat(object): with os.fdopen(fd, 'w') as cache: outstream = cache blockiter = readblocks(sys.stdin) - # Check whether this file is hanging - block = next(blockiter) - if self.decode_clean(block[0:self.magiclen]): - ishanging = True - outstream = sys.stdout - h.update(block) - bytes += len(block) - outstream.write(block) - for block in blockiter: + firstblock = True + for block in readblocks(sys.stdin): + if firstblock: + if len(block) == self.magiclen and self.decode_clean(block[0:self.magiclen]): + ishanging = True # Working tree version is verbatim from repository (not smudged) + outstream = sys.stdout + firstblock = False h.update(block) bytes += len(block) outstream.write(block) -- cgit v1.2.1