Browse Source

PackWriter: Refactor object writing loop

This simple refactoring makes it easier to pre-process each of the
object lists before its handed into the actual write routine.

Change-Id: Iea95e5ecbc7374f6bcbb43d1c75285f4f564d09d
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
stable-0.12
Shawn O. Pearce 14 years ago
parent
commit
26dffbe04d
  1. 15
      org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java

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

@ -977,14 +977,17 @@ public class PackWriter {
} }
private void writeObjects(PackOutputStream out) throws IOException { private void writeObjects(PackOutputStream out) throws IOException {
for (List<ObjectToPack> list : objectsLists)
writeObjects(out, list);
}
private void writeObjects(PackOutputStream out, List<ObjectToPack> list)
throws IOException {
if (reuseSupport != null) { if (reuseSupport != null) {
for (List<ObjectToPack> list : objectsLists) reuseSupport.writeObjects(out, list);
reuseSupport.writeObjects(out, list);
} else { } else {
for (List<ObjectToPack> list : objectsLists) { for (ObjectToPack otp : list)
for (ObjectToPack otp : list) out.writeObject(otp);
out.writeObject(otp);
}
} }
} }

Loading…
Cancel
Save