Browse Source

PackWriter: Use TOPO order only for incremental packs

When performing an initial clone of a repository there are no
uninteresting commits, and the resulting pack will be completely
self-contained.  Therefore PackWriter does not need to honor C
Git standard TOPO ordering as described in JGit commit ba984ba2e0
("Fix checkReferencedIsReachable to use correct base list").

Switching to COMMIT_TIME_DESC when there are no uninteresting commits
allows the "Counting objects" phase to emit progress earlier, as the
RevWalk will not buffer the commit list.  When TOPO is set the RevWalk
enumerates all commits first, before outputing any for PackWriter to
mark progress updates from.

Change-Id: If2b6a9903b536c7fb3c45f85d0a67ff6c6e66f22
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
stable-0.11
Shawn O. Pearce 14 years ago
parent
commit
c218a0760d
  1. 5
      org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java

5
org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java

@ -992,7 +992,10 @@ public class PackWriter {
final ObjectWalk walker = new ObjectWalk(reader); final ObjectWalk walker = new ObjectWalk(reader);
walker.setRetainBody(false); walker.setRetainBody(false);
walker.sort(RevSort.TOPO); if (not.isEmpty())
walker.sort(RevSort.COMMIT_TIME_DESC);
else
walker.sort(RevSort.TOPO);
if (thin && !not.isEmpty()) if (thin && !not.isEmpty())
walker.sort(RevSort.BOUNDARY, true); walker.sort(RevSort.BOUNDARY, true);

Loading…
Cancel
Save