From 26dffbe04df62b4cb9e5d8f900ebc474c934392a Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Mon, 28 Feb 2011 16:08:05 -0800 Subject: [PATCH] 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 --- .../org/eclipse/jgit/storage/pack/PackWriter.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java index e9eb366f6..2a5caf854 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java +++ b/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 { + for (List list : objectsLists) + writeObjects(out, list); + } + + private void writeObjects(PackOutputStream out, List list) + throws IOException { if (reuseSupport != null) { - for (List list : objectsLists) - reuseSupport.writeObjects(out, list); + reuseSupport.writeObjects(out, list); } else { - for (List list : objectsLists) { - for (ObjectToPack otp : list) - out.writeObject(otp); - } + for (ObjectToPack otp : list) + out.writeObject(otp); } }