diff options
author | Jed Brown <jed@59A2.org> | 2013-01-20 19:54:26 -0600 |
---|---|---|
committer | Jed Brown <jed@59A2.org> | 2013-01-20 19:54:26 -0600 |
commit | f5759238e10c64889187214401b24cf028f9d3a6 (patch) | |
tree | c6e3fe4f60145a70978e23a54cc70828a0abf47c /git-fat | |
parent | c6aa57f72218146cf005f0747c8091ca73e8cf12 (diff) | |
download | git-fat-f5759238e10c64889187214401b24cf028f9d3a6.tar.gz |
filter-clean: fix for zero-length files causing early StopIteration
Diffstat (limited to 'git-fat')
-rwxr-xr-x | git-fat | 16 |
1 files changed, 7 insertions, 9 deletions
@@ -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) |