aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/transport
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/transport')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java23
1 files changed, 16 insertions, 7 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 6254745476..0469c1ac0b 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java
@@ -70,6 +70,7 @@ import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.FileMode;
import org.eclipse.jgit.lib.MutableObjectId;
import org.eclipse.jgit.lib.ObjectChecker;
+import org.eclipse.jgit.lib.ObjectDirectory;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.PackIndex;
import org.eclipse.jgit.lib.PackLock;
@@ -240,8 +241,10 @@ class WalkFetchConnection extends BaseFetchConnection {
@Override
public void close() {
- for (final RemotePack p : unfetchedPacks)
- p.tmpIdx.delete();
+ for (final RemotePack p : unfetchedPacks) {
+ if (p.tmpIdx != null)
+ p.tmpIdx.delete();
+ }
for (final WalkRemoteObjectDatabase r : remotes)
r.close();
}
@@ -512,7 +515,8 @@ class WalkFetchConnection extends BaseFetchConnection {
// it failed the index and pack are unusable and we
// shouldn't consult them again.
//
- pack.tmpIdx.delete();
+ if (pack.tmpIdx != null)
+ pack.tmpIdx.delete();
packItr.remove();
}
@@ -788,12 +792,11 @@ class WalkFetchConnection extends BaseFetchConnection {
final String idxName;
- final File tmpIdx;
+ File tmpIdx;
PackIndex index;
RemotePack(final WalkRemoteObjectDatabase c, final String pn) {
- final File objdir = local.getObjectsDirectory();
connection = c;
packName = pn;
idxName = packName.substring(0, packName.length() - 5) + ".idx";
@@ -803,13 +806,19 @@ class WalkFetchConnection extends BaseFetchConnection {
tn = tn.substring(5);
if (tn.endsWith(".idx"))
tn = tn.substring(0, tn.length() - 4);
- tmpIdx = new File(objdir, "walk-" + tn + ".walkidx");
+
+ if (local.getObjectDatabase() instanceof ObjectDirectory) {
+ tmpIdx = new File(((ObjectDirectory) local.getObjectDatabase())
+ .getDirectory(), "walk-" + tn + ".walkidx");
+ }
}
void openIndex(final ProgressMonitor pm) throws IOException {
if (index != null)
return;
- if (tmpIdx.isFile()) {
+ if (tmpIdx == null)
+ tmpIdx = File.createTempFile("jgit-walk-", ".idx");
+ else if (tmpIdx.isFile()) {
try {
index = PackIndex.open(tmpIdx);
return;