summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@gmail.com>2016-07-21 16:07:04 +0900
committerDavid Pursehouse <david.pursehouse@gmail.com>2016-07-26 10:09:35 +0900
commit0be80218199afc42d9266ffb1a6ff4fe84bfb28a (patch)
treeb67a724aa54efd9a8bc5c3b6d8b58197de53baeb /org.eclipse.jgit
parenta2d3c376a682b540ecd87fe3ff2ffebc1766f938 (diff)
parentdf479df17676148bf6391401a704a7d7265c45fa (diff)
downloadjgit-0be80218199afc42d9266ffb1a6ff4fe84bfb28a.tar.gz
jgit-0be80218199afc42d9266ffb1a6ff4fe84bfb28a.zip
Merge branch 'stable-4.4'
* stable-4.4: JGit v4.4.1.201607150455-r RefDirectory: remove ref lock file for following ref dir removal Change-Id: Ifc8a782efd7f2f991e70ad2a3691a8dba66c7554 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java19
1 files changed, 15 insertions, 4 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java
index 4bb2982b48..e5ca736824 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java
@@ -688,7 +688,7 @@ public class RefDirectory extends RefDatabase {
newLoose = curLoose.remove(idx);
} while (!looseRefs.compareAndSet(curLoose, newLoose));
int levels = levelsIn(refName) - 2;
- delete(fileFor(refName), levels);
+ delete(refFile, levels, rLck);
}
} finally {
rLck.unlock();
@@ -1062,13 +1062,24 @@ public class RefDirectory extends RefDatabase {
}
static void delete(final File file, final int depth) throws IOException {
- if (!file.delete() && file.isFile())
- throw new IOException(MessageFormat.format(JGitText.get().fileCannotBeDeleted, file));
+ delete(file, depth, null);
+ }
+ private static void delete(final File file, final int depth, LockFile rLck)
+ throws IOException {
+ if (!file.delete() && file.isFile()) {
+ throw new IOException(MessageFormat.format(
+ JGitText.get().fileCannotBeDeleted, file));
+ }
+
+ if (rLck != null) {
+ rLck.unlock(); // otherwise cannot delete dir below
+ }
File dir = file.getParentFile();
for (int i = 0; i < depth; ++i) {
- if (!dir.delete())
+ if (!dir.delete()) {
break; // ignore problem here
+ }
dir = dir.getParentFile();
}
}