]> arthur.barton.de Git - bup.git/commitdiff
client/server: correctly handle case where receive-objects had 0 objects.
authorAvery Pennarun <apenwarr@gmail.com>
Sun, 14 Mar 2010 05:15:29 +0000 (00:15 -0500)
committerAvery Pennarun <apenwarr@gmail.com>
Sun, 14 Mar 2010 05:15:29 +0000 (00:15 -0500)
Previously we'd throw a (probably harmless other than ugly output)
exception in this case.

cmd/server-cmd.py
lib/bup/client.py

index 3fea0a9346f8c3b992c51aec3ccb749456fa11ff..647657b88bc80f3a9b42eebf4bd99207e022d3c5 100755 (executable)
@@ -56,8 +56,9 @@ def receive_objects(conn, junk):
             log('bup server: received %d object%s.\n' 
                 % (w.count, w.count!=1 and "s" or ''))
             fullpath = w.close()
-            (dir, name) = os.path.split(fullpath)
-            conn.write('%s.idx\n' % name)
+            if fullpath:
+                (dir, name) = os.path.split(fullpath)
+                conn.write('%s.idx\n' % name)
             conn.ok()
             return
         elif n == 0xffffffff:
index a5762ae4b652c4f552beae6d92ee593a09fa8941..e236c0636f5b3c35566965a5c071de00f29ab9f9 100644 (file)
@@ -232,7 +232,7 @@ class PackWriter_Remote(git.PackWriter):
             self.objcache = None
             if self.onclose:
                 self.onclose()
-            if self.suggest_pack:
+            if id and self.suggest_pack:
                 self.suggest_pack(id)
             return id