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. 9
      org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java

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

@ -977,16 +977,19 @@ public class PackWriter {
} }
private void writeObjects(PackOutputStream out) throws IOException { private void writeObjects(PackOutputStream out) throws IOException {
if (reuseSupport != null) {
for (List<ObjectToPack> list : objectsLists) for (List<ObjectToPack> list : objectsLists)
writeObjects(out, list);
}
private void writeObjects(PackOutputStream out, List<ObjectToPack> list)
throws IOException {
if (reuseSupport != null) {
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);
} }
} }
}
void writeObject(PackOutputStream out, ObjectToPack otp) throws IOException { void writeObject(PackOutputStream out, ObjectToPack otp) throws IOException {
if (otp.isWritten()) if (otp.isWritten())

Loading…
Cancel
Save