]> source.dussan.org Git - jgit.git/commitdiff
If a pack isn't found on disk remove it from pack list 03/40503/1
authorMatthias Sohn <matthias.sohn@sap.com>
Mon, 26 Jan 2015 13:56:25 +0000 (14:56 +0100)
committerMatthias Sohn <matthias.sohn@sap.com>
Tue, 27 Jan 2015 23:37:39 +0000 (18:37 -0500)
If accessing a pack throws FileNotFoundException the pack was deleted
and we need to remove it from the pack list. This can be caused e.g. by
git gc.

Change-Id: I5d10f87f364dadbbdbfb61b6b2cbdee9c7457f3d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties
org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java

index 55cf3ea71e6d4f29bba7af640c055b938faebc10..7e5f0b022c479fda9c06cb179f8b29f1b27b963e 100644 (file)
@@ -392,6 +392,7 @@ packObjectCountMismatch=Pack object count mismatch: pack {0} index {1}: {2}
 packRefs=Pack refs
 packSizeNotSetYet=Pack size not yet set since it has not yet been received
 packTooLargeForIndexVersion1=Pack too large for index version 1
+packWasDeleted=Pack file {0} was deleted, removing it from pack list
 packWriterStatistics=Total {0,number,#0} (delta {1,number,#0}), reused {2,number,#0} (delta {3,number,#0})
 panicCantRenameIndexFile=Panic: index file {0} must be renamed to replace {1}; until then repository is corrupt
 patchApplyException=Cannot apply: {0}
index fd38dc149173bffa4cfd7fd49b3deb1a865c97a3..caf3e9072c99a956d9d48e9cb331a1524b33fd75 100644 (file)
@@ -451,6 +451,7 @@ public class JGitText extends TranslationBundle {
        /***/ public String packRefs;
        /***/ public String packSizeNotSetYet;
        /***/ public String packTooLargeForIndexVersion1;
+       /***/ public String packWasDeleted;
        /***/ public String packWriterStatistics;
        /***/ public String panicCantRenameIndexFile;
        /***/ public String patchApplyException;
index 76fadefe53d1a9ae90697c61950b9e73ffae272b..adbe1f8652a08a00d5260b44d70994d2575a4570 100644 (file)
@@ -557,6 +557,9 @@ public class ObjectDirectory extends FileObjectDatabase {
                        tmpl = JGitText.get().corruptPack;
                        // Assume the pack is corrupted, and remove it from the list.
                        removePack(p);
+               } else if (e instanceof FileNotFoundException) {
+                       tmpl = JGitText.get().packWasDeleted;
+                       removePack(p);
                } else {
                        tmpl = JGitText.get().exceptionWhileReadingPack;
                        // Don't remove the pack from the list, as the error may be