summaryrefslogtreecommitdiff
path: root/git-fat
diff options
context:
space:
mode:
authorJed Brown <jed@59A2.org>2013-01-20 19:54:26 -0600
committerJed Brown <jed@59A2.org>2013-01-20 19:54:26 -0600
commitf5759238e10c64889187214401b24cf028f9d3a6 (patch)
treec6e3fe4f60145a70978e23a54cc70828a0abf47c /git-fat
parentc6aa57f72218146cf005f0747c8091ca73e8cf12 (diff)
downloadgit-fat-f5759238e10c64889187214401b24cf028f9d3a6.tar.gz
filter-clean: fix for zero-length files causing early StopIteration
Diffstat (limited to 'git-fat')
-rwxr-xr-xgit-fat16
1 files changed, 7 insertions, 9 deletions
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)