|
|
@@ -52,6 +52,8 @@ import java.io.FileInputStream; |
|
|
|
import java.io.FileNotFoundException; |
|
|
|
import java.io.FileReader; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.PrintWriter; |
|
|
|
import java.io.StringWriter; |
|
|
|
import java.text.MessageFormat; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Arrays; |
|
|
@@ -329,7 +331,7 @@ public class ObjectDirectory extends FileObjectDatabase { |
|
|
|
p.resolve(matches, id, RESOLVE_ABBREV_LIMIT); |
|
|
|
} catch (IOException e) { |
|
|
|
// Assume the pack is corrupted. |
|
|
|
// |
|
|
|
logCorruptPackError(e, p); |
|
|
|
removePack(p); |
|
|
|
} |
|
|
|
if (matches.size() > RESOLVE_ABBREV_LIMIT) |
|
|
@@ -418,6 +420,7 @@ public class ObjectDirectory extends FileObjectDatabase { |
|
|
|
continue SEARCH; |
|
|
|
} catch (IOException e) { |
|
|
|
// Assume the pack is corrupted. |
|
|
|
logCorruptPackError(e, p); |
|
|
|
removePack(p); |
|
|
|
} |
|
|
|
} |
|
|
@@ -499,6 +502,7 @@ public class ObjectDirectory extends FileObjectDatabase { |
|
|
|
continue SEARCH; |
|
|
|
} catch (IOException e) { |
|
|
|
// Assume the pack is corrupted. |
|
|
|
logCorruptPackError(e, p); |
|
|
|
removePack(p); |
|
|
|
} |
|
|
|
} |
|
|
@@ -541,7 +545,7 @@ public class ObjectDirectory extends FileObjectDatabase { |
|
|
|
continue SEARCH; |
|
|
|
} catch (IOException e) { |
|
|
|
// Assume the pack is corrupted. |
|
|
|
// |
|
|
|
logCorruptPackError(e, p); |
|
|
|
removePack(p); |
|
|
|
} |
|
|
|
} |
|
|
@@ -552,6 +556,18 @@ public class ObjectDirectory extends FileObjectDatabase { |
|
|
|
h.db.selectObjectRepresentation(packer, otp, curs); |
|
|
|
} |
|
|
|
|
|
|
|
private static void logCorruptPackError(IOException e, PackFile p) { |
|
|
|
StringBuilder buf = new StringBuilder(MessageFormat.format( |
|
|
|
JGitText.get().exceptionWhileReadingPack, |
|
|
|
p.getPackFile().getAbsolutePath())); |
|
|
|
StringWriter sw = new StringWriter(); |
|
|
|
e.printStackTrace(new PrintWriter(sw)); |
|
|
|
buf.append('\n'); |
|
|
|
buf.append(sw.toString()); |
|
|
|
// TODO instead of syserr we should use a logging framework |
|
|
|
System.err.println(buf.toString()); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
InsertLooseObjectResult insertUnpackedObject(File tmp, ObjectId id, |
|
|
|
boolean createDuplicate) throws IOException { |