Merge remote-tracking branch 'origin/stable-3.6'
* origin/stable-3.6: Prepare 3.6.3-SNAPSHOT builds JGit v3.6.2.201501210735-r Don't remove pack from pack list for problems which could be transient Log reason for ignoring pack when IOException occurred Change-Id: I61141b52839511d58e5a5b193bfde31e9f444a6c Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
commit
e7f153bf3a
|
@ -145,6 +145,7 @@ couldNotRenameTemporaryIndexFileToIndex=Could not rename temporary index file to
|
||||||
couldNotURLEncodeToUTF8=Could not URL encode to UTF-8
|
couldNotURLEncodeToUTF8=Could not URL encode to UTF-8
|
||||||
couldNotWriteFile=Could not write file {0}
|
couldNotWriteFile=Could not write file {0}
|
||||||
countingObjects=Counting objects
|
countingObjects=Counting objects
|
||||||
|
corruptPack=Pack file {0} is corrupt
|
||||||
createBranchFailedUnknownReason=Create branch failed for unknown reason
|
createBranchFailedUnknownReason=Create branch failed for unknown reason
|
||||||
createBranchUnexpectedResult=Create branch returned unexpected result {0}
|
createBranchUnexpectedResult=Create branch returned unexpected result {0}
|
||||||
createNewFileFailed=Could not create new file {0}
|
createNewFileFailed=Could not create new file {0}
|
||||||
|
@ -207,6 +208,7 @@ exceptionCaughtDuringExecutionOfRmCommand=Exception caught during execution of r
|
||||||
exceptionCaughtDuringExecutionOfTagCommand=Exception caught during execution of tag command
|
exceptionCaughtDuringExecutionOfTagCommand=Exception caught during execution of tag command
|
||||||
exceptionOccurredDuringAddingOfOptionToALogCommand=Exception occurred during adding of {0} as option to a Log command
|
exceptionOccurredDuringAddingOfOptionToALogCommand=Exception occurred during adding of {0} as option to a Log command
|
||||||
exceptionOccurredDuringReadingOfGIT_DIR=Exception occurred during reading of $GIT_DIR/{0}. {1}
|
exceptionOccurredDuringReadingOfGIT_DIR=Exception occurred during reading of $GIT_DIR/{0}. {1}
|
||||||
|
exceptionWhileReadingPack=ERROR: Exception caught while accessing pack file {0}, the pack file might be corrupt
|
||||||
expectedACKNAKFoundEOF=Expected ACK/NAK, found EOF
|
expectedACKNAKFoundEOF=Expected ACK/NAK, found EOF
|
||||||
expectedACKNAKGot=Expected ACK/NAK, got: {0}
|
expectedACKNAKGot=Expected ACK/NAK, got: {0}
|
||||||
expectedBooleanStringValue=Expected boolean string value
|
expectedBooleanStringValue=Expected boolean string value
|
||||||
|
|
|
@ -190,6 +190,7 @@ public static JGitText get() {
|
||||||
/***/ public String corruptObjectNotree;
|
/***/ public String corruptObjectNotree;
|
||||||
/***/ public String corruptObjectNoType;
|
/***/ public String corruptObjectNoType;
|
||||||
/***/ public String corruptObjectPackfileChecksumIncorrect;
|
/***/ public String corruptObjectPackfileChecksumIncorrect;
|
||||||
|
/***/ public String corruptPack;
|
||||||
/***/ public String couldNotCheckOutBecauseOfConflicts;
|
/***/ public String couldNotCheckOutBecauseOfConflicts;
|
||||||
/***/ public String couldNotDeleteLockFileShouldNotHappen;
|
/***/ public String couldNotDeleteLockFileShouldNotHappen;
|
||||||
/***/ public String couldNotDeleteTemporaryIndexFileShouldNotHappen;
|
/***/ public String couldNotDeleteTemporaryIndexFileShouldNotHappen;
|
||||||
|
@ -266,6 +267,7 @@ public static JGitText get() {
|
||||||
/***/ public String exceptionCaughtDuringExecutionOfTagCommand;
|
/***/ public String exceptionCaughtDuringExecutionOfTagCommand;
|
||||||
/***/ public String exceptionOccurredDuringAddingOfOptionToALogCommand;
|
/***/ public String exceptionOccurredDuringAddingOfOptionToALogCommand;
|
||||||
/***/ public String exceptionOccurredDuringReadingOfGIT_DIR;
|
/***/ public String exceptionOccurredDuringReadingOfGIT_DIR;
|
||||||
|
/***/ public String exceptionWhileReadingPack;
|
||||||
/***/ public String expectedACKNAKFoundEOF;
|
/***/ public String expectedACKNAKFoundEOF;
|
||||||
/***/ public String expectedACKNAKGot;
|
/***/ public String expectedACKNAKGot;
|
||||||
/***/ public String expectedBooleanStringValue;
|
/***/ public String expectedBooleanStringValue;
|
||||||
|
|
|
@ -52,6 +52,8 @@
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.io.StringWriter;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -64,6 +66,8 @@
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
|
import org.eclipse.jgit.errors.CorruptObjectException;
|
||||||
|
import org.eclipse.jgit.errors.PackInvalidException;
|
||||||
import org.eclipse.jgit.errors.PackMismatchException;
|
import org.eclipse.jgit.errors.PackMismatchException;
|
||||||
import org.eclipse.jgit.internal.JGitText;
|
import org.eclipse.jgit.internal.JGitText;
|
||||||
import org.eclipse.jgit.internal.storage.pack.ObjectToPack;
|
import org.eclipse.jgit.internal.storage.pack.ObjectToPack;
|
||||||
|
@ -328,9 +332,7 @@ void resolve(Set<ObjectId> matches, AbbreviatedObjectId id)
|
||||||
try {
|
try {
|
||||||
p.resolve(matches, id, RESOLVE_ABBREV_LIMIT);
|
p.resolve(matches, id, RESOLVE_ABBREV_LIMIT);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// Assume the pack is corrupted.
|
handlePackError(e, p);
|
||||||
//
|
|
||||||
removePack(p);
|
|
||||||
}
|
}
|
||||||
if (matches.size() > RESOLVE_ABBREV_LIMIT)
|
if (matches.size() > RESOLVE_ABBREV_LIMIT)
|
||||||
return;
|
return;
|
||||||
|
@ -417,8 +419,7 @@ ObjectLoader openPackedObject(WindowCursor curs, AnyObjectId objectId) {
|
||||||
if (searchPacksAgain(pList))
|
if (searchPacksAgain(pList))
|
||||||
continue SEARCH;
|
continue SEARCH;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// Assume the pack is corrupted.
|
handlePackError(e, p);
|
||||||
removePack(p);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break SEARCH;
|
break SEARCH;
|
||||||
|
@ -498,8 +499,7 @@ private long getPackedObjectSize(WindowCursor curs, AnyObjectId id) {
|
||||||
if (searchPacksAgain(pList))
|
if (searchPacksAgain(pList))
|
||||||
continue SEARCH;
|
continue SEARCH;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// Assume the pack is corrupted.
|
handlePackError(e, p);
|
||||||
removePack(p);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break SEARCH;
|
break SEARCH;
|
||||||
|
@ -540,9 +540,7 @@ void selectObjectRepresentation(PackWriter packer, ObjectToPack otp,
|
||||||
pList = scanPacks(pList);
|
pList = scanPacks(pList);
|
||||||
continue SEARCH;
|
continue SEARCH;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// Assume the pack is corrupted.
|
handlePackError(e, p);
|
||||||
//
|
|
||||||
removePack(p);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break SEARCH;
|
break SEARCH;
|
||||||
|
@ -552,6 +550,28 @@ void selectObjectRepresentation(PackWriter packer, ObjectToPack otp,
|
||||||
h.db.selectObjectRepresentation(packer, otp, curs);
|
h.db.selectObjectRepresentation(packer, otp, curs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void handlePackError(IOException e, PackFile p) {
|
||||||
|
String tmpl;
|
||||||
|
if ((e instanceof CorruptObjectException)
|
||||||
|
|| (e instanceof PackInvalidException)) {
|
||||||
|
tmpl = JGitText.get().corruptPack;
|
||||||
|
// Assume the pack is corrupted, and remove it from the list.
|
||||||
|
removePack(p);
|
||||||
|
} else {
|
||||||
|
tmpl = JGitText.get().exceptionWhileReadingPack;
|
||||||
|
// Don't remove the pack from the list, as the error may be
|
||||||
|
// transient.
|
||||||
|
}
|
||||||
|
StringBuilder buf = new StringBuilder(MessageFormat.format(tmpl,
|
||||||
|
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
|
@Override
|
||||||
InsertLooseObjectResult insertUnpackedObject(File tmp, ObjectId id,
|
InsertLooseObjectResult insertUnpackedObject(File tmp, ObjectId id,
|
||||||
boolean createDuplicate) throws IOException {
|
boolean createDuplicate) throws IOException {
|
||||||
|
|
Loading…
Reference in New Issue