Browse Source

If a pack isn't found on disk remove it from pack list

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>
tags/v3.7.0.201502031740-rc1
Matthias Sohn 9 years ago
parent
commit
f5936405a3

+ 1
- 0
org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties View File

packRefs=Pack refs packRefs=Pack refs
packSizeNotSetYet=Pack size not yet set since it has not yet been received packSizeNotSetYet=Pack size not yet set since it has not yet been received
packTooLargeForIndexVersion1=Pack too large for index version 1 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}) 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 panicCantRenameIndexFile=Panic: index file {0} must be renamed to replace {1}; until then repository is corrupt
patchApplyException=Cannot apply: {0} patchApplyException=Cannot apply: {0}

+ 1
- 0
org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java View File

/***/ public String packRefs; /***/ public String packRefs;
/***/ public String packSizeNotSetYet; /***/ public String packSizeNotSetYet;
/***/ public String packTooLargeForIndexVersion1; /***/ public String packTooLargeForIndexVersion1;
/***/ public String packWasDeleted;
/***/ public String packWriterStatistics; /***/ public String packWriterStatistics;
/***/ public String panicCantRenameIndexFile; /***/ public String panicCantRenameIndexFile;
/***/ public String patchApplyException; /***/ public String patchApplyException;

+ 3
- 0
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java View File

tmpl = JGitText.get().corruptPack; tmpl = JGitText.get().corruptPack;
// Assume the pack is corrupted, and remove it from the list. // Assume the pack is corrupted, and remove it from the list.
removePack(p); removePack(p);
} else if (e instanceof FileNotFoundException) {
tmpl = JGitText.get().packWasDeleted;
removePack(p);
} else { } else {
tmpl = JGitText.get().exceptionWhileReadingPack; tmpl = JGitText.get().exceptionWhileReadingPack;
// Don't remove the pack from the list, as the error may be // Don't remove the pack from the list, as the error may be

Loading…
Cancel
Save