aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2021-01-03 02:10:58 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2021-02-05 20:48:51 -0500
commit58f2e23fded26f8f4a1bfe436b1cbe72bcc11aa4 (patch)
treec63e38b4c32c74e39c85ed82531628e0f248c88c /org.eclipse.jgit/src/org/eclipse
parent9299df41cb941ab21b6c4bd835510305b7fd5382 (diff)
downloadjgit-58f2e23fded26f8f4a1bfe436b1cbe72bcc11aa4.tar.gz
jgit-58f2e23fded26f8f4a1bfe436b1cbe72bcc11aa4.zip
Fix FileRepository#convertToReftable which failed if no reflog existed
Deleting non-existing files when converting to reftable without backup caused convertToReftable to fail. Observed this on a mirrored repository which had no reflogs. Fix this by skipping missing files during deletion. Change-Id: I3bb913d5bfddccc6813677b873006efb849a6ebc Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java
index b939d37ca2..51ee9e9d10 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java
@@ -759,12 +759,14 @@ public class FileRepository extends Repository {
}
} else {
FileUtils.delete(packedRefs, FileUtils.SKIP_MISSING);
- FileUtils.delete(headFile);
- FileUtils.delete(logsDir, FileUtils.RECURSIVE);
- FileUtils.delete(refsFile, FileUtils.RECURSIVE);
+ FileUtils.delete(headFile, FileUtils.SKIP_MISSING);
+ FileUtils.delete(logsDir,
+ FileUtils.RECURSIVE | FileUtils.SKIP_MISSING);
+ FileUtils.delete(refsFile,
+ FileUtils.RECURSIVE | FileUtils.SKIP_MISSING);
for (String r : additional) {
new File(getDirectory(), r).delete();
- }
+ }
}
FileUtils.mkdir(refsFile, true);