Allow PackWriter to prepare object list and compute name before writing
commit9ccfde23263145cdf49f094e00530e2350407437
authorShawn O. Pearce <spearce@spearce.org>
Sun, 29 Jun 2008 07:59:18 +0000 (29 03:59 -0400)
committerRobin Rosenberg <robin.rosenberg@dewire.com>
Mon, 30 Jun 2008 22:46:22 +0000 (1 00:46 +0200)
treed575a32179b90aa72d53c394ff2ab307a17d4ed4
parent7c66b122ce0988a386aaa13bba3c80cc6eda6f83
Allow PackWriter to prepare object list and compute name before writing

When we are writing a pack for a dumb protocol transport we want to
get the name of the pack prior to generating its output stream.  This
permits us to open the pack stream directly under its final name and
write into it without needing to issue a rename in the middle of the
process.  By splitting the pack preparing phase from the writing phase
we are able to request computeName() between the two stages and create
the OutputStream based upon the result.

To improve performance we also now buffer what we write to the pack
stream, if the pack stream was not already a buffered stream.

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/lib/PackWriter.java
org.spearce.jgit/src/org/spearce/jgit/transport/BasePackPushConnection.java