|
|
|
@ -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(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|