]> arthur.barton.de Git - bup.git/commitdiff
Use chunkyreader() instead of manually reading multiple blocks.
authorBrandon Low <lostlogic@lostlogicx.com>
Sun, 2 Jan 2011 08:49:22 +0000 (00:49 -0800)
committerAvery Pennarun <apenwarr@gmail.com>
Mon, 3 Jan 2011 03:10:26 +0000 (19:10 -0800)
Signed-off-by: Brandon Low <lostlogic@lostlogicx.com>
lib/bup/git.py

index 6a65c435450233702dea291113c417e423c0419f..4ca31d76376f35a2166cf2fabf7185ee56dae17d 100644 (file)
@@ -651,12 +651,9 @@ class PackWriter:
         # calculate the pack sha1sum
         f.seek(0)
         sum = Sha1()
-        while 1:
-            b = f.read(65536)
+        for b in chunkyreader(f):
             sum.update(b)
-            if not b: break
         f.write(sum.digest())
-
         f.close()
 
         p = subprocess.Popen(['git', 'index-pack', '-v',