Don't keep an empty pack uploaded through receive-pack
commitaa4d277e873c8c77a13cc82736b3697e5fe15da0
authorShawn O. Pearce <spearce@spearce.org>
Sun, 8 Feb 2009 20:46:13 +0000 (8 12:46 -0800)
committerRobin Rosenberg <robin.rosenberg@dewire.com>
Mon, 9 Feb 2009 00:50:49 +0000 (9 01:50 +0100)
tree985b82ea6d7efad7f314238640ba7c483d66d7e2
parent6aaae1358922b9c972fd23055e0588f333f68275
Don't keep an empty pack uploaded through receive-pack

The receive-pack protocol sometimes gets an empty pack file if
there are commands to process but no data was needed to be sent.
In such cases we shouldn't create an empty 32 byte pack on disk,
but instead should discard it.

Since ReceivePack doesn't read the pack header, we only know
the empty state inside of IndexPack.  So we fix it here, to
avoid duplicating the header parsing code into ReceivePack.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
org.spearce.jgit.test/tst/org/spearce/jgit/lib/PackWriterTest.java
org.spearce.jgit/src/org/spearce/jgit/transport/IndexPack.java