From: Avery Pennarun Date: Sun, 14 Mar 2010 05:15:29 +0000 (-0500) Subject: client/server: correctly handle case where receive-objects had 0 objects. X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=96075fce26dc570c0308f6cf16b96becece2e02c;p=packages%2Fb%2Fbup.git client/server: correctly handle case where receive-objects had 0 objects. Previously we'd throw a (probably harmless other than ugly output) exception in this case. --- diff --git a/cmd/server-cmd.py b/cmd/server-cmd.py index 3fea0a9..647657b 100755 --- a/cmd/server-cmd.py +++ b/cmd/server-cmd.py @@ -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: diff --git a/lib/bup/client.py b/lib/bup/client.py index a5762ae..e236c06 100644 --- a/lib/bup/client.py +++ b/lib/bup/client.py @@ -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