aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorZhen Chen <czhen@google.com>2016-09-30 12:11:46 -0700
committerMatthias Sohn <matthias.sohn@sap.com>2016-10-02 00:41:33 +0200
commit0212a623f8bbb1ddc422c4b58fb40670c488101f (patch)
treeb79ffc44c0cf38fffd2b3fce027974aa994c78aa /org.eclipse.jgit
parent1bafc304c80f442ead757e6869de689778c15d3d (diff)
downloadjgit-0212a623f8bbb1ddc422c4b58fb40670c488101f.tar.gz
jgit-0212a623f8bbb1ddc422c4b58fb40670c488101f.zip
Delay inserter.flush in WalkFetchConnection
Spawn an ObjectReader from the ObjectInserter, so the flush can be delayed at the end of the fetch. Change-Id: I35fe8c8370c06c25262645202aec2b1318057c19 Signed-off-by: Zhen Chen <czhen@google.com>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java
index 17edfdc4fb..c90cadf7b6 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java
@@ -195,7 +195,7 @@ class WalkFetchConnection extends BaseFetchConnection {
local = wt.local;
objCheck = wt.getObjectChecker();
inserter = local.newObjectInserter();
- reader = local.newObjectReader();
+ reader = inserter.newReader();
remotes = new ArrayList<WalkRemoteObjectDatabase>();
remotes.add(w);
@@ -240,6 +240,12 @@ class WalkFetchConnection extends BaseFetchConnection {
downloadObject(monitor, id);
process(id);
}
+
+ try {
+ inserter.flush();
+ } catch (IOException e) {
+ throw new TransportException(e.getMessage(), e);
+ }
}
public Collection<PackLock> getPackLocks() {
@@ -652,7 +658,6 @@ class WalkFetchConnection extends BaseFetchConnection {
Constants.typeString(type),
Integer.valueOf(compressed.length)));
}
- inserter.flush();
}
private Collection<WalkRemoteObjectDatabase> expandOneAlternate(
@@ -883,7 +888,6 @@ class WalkFetchConnection extends BaseFetchConnection {
PackLock lock = parser.parse(monitor);
if (lock != null)
packLocks.add(lock);
- inserter.flush();
}
}
}