Refactor PackWriter to hold onto the sorted object list
When creating pack files we sometimes need the sorted object list
of all contents for two reasons. The first is to get the name of
the pack, which computeName() returns today. The other reason is
to generate a corresponding .idx file for this pack, to support
random access into the data.
Since not all uses of PackWriter require the sorted object name list
(for example streaming the pack to a network socket) the sorting is
done on demand, and cached to avoid needing to do it a second time.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>