summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@gmail.com>2019-03-05 10:23:38 +0900
committerDavid Pursehouse <david.pursehouse@gmail.com>2019-03-05 10:23:38 +0900
commitc2dbdabfb9616e7d9b34ee7c35a2ace43b79a903 (patch)
treefec476ff930a703c0c778140a875828d1cef8ea7 /org.eclipse.jgit
parent90876890bc28f0baad5b12b8aa2f189a6738e1c3 (diff)
parent997d785418d55dce5a1188fdb95e6d2b4ab0bde5 (diff)
downloadjgit-c2dbdabfb9616e7d9b34ee7c35a2ace43b79a903.tar.gz
jgit-c2dbdabfb9616e7d9b34ee7c35a2ace43b79a903.zip
Merge branch 'stable-5.1' into stable-5.2
* stable-5.1: Fix error log message in ObjectDirectory.handlePackError() Properly format pack checksums in PackFile.idx() Cancel gc if thread was interrupted PackFile: report correct message for checksum mismatch ObjectDirectory: Clean up logging Bazel: Stop using native.git_repository Change-Id: I42b72a3bba3b4c9389d91a1a35a8004836567e7c Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties5
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java1
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java11
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java12
5 files changed, 19 insertions, 12 deletions
diff --git a/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties b/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties
index fca9018db0..12fded8361 100644
--- a/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties
+++ b/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties
@@ -289,7 +289,7 @@ exceptionCaughtDuringExecutionOfTagCommand=Exception caught during execution of
exceptionHookExecutionInterrupted=Execution of "{0}" hook interrupted.
exceptionOccurredDuringAddingOfOptionToALogCommand=Exception occurred during adding of {0} as option to a Log command
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, {1}. Caught {2} consecutive errors while trying to read this pack.
+exceptionWhileReadingPack=Exception caught while accessing pack file {0}, the pack file might be corrupt. Caught {1} consecutive errors while trying to read this pack.
expectedACKNAKFoundEOF=Expected ACK/NAK, found EOF
expectedACKNAKGot=Expected ACK/NAK, got: {0}
expectedBooleanStringValue=Expected boolean string value
@@ -510,7 +510,7 @@ openingConnection=Opening connection
operationCanceled=Operation {0} was canceled
outputHasAlreadyBeenStarted=Output has already been started.
overflowedReftableBlock=Overflowed reftable block
-packChecksumMismatch=Pack checksum mismatch detected for pack file {0}
+packChecksumMismatch=Pack checksum mismatch detected for pack file {0}: .pack has {1} whilst .idx has {2}
packCorruptedWhileWritingToFilesystem=Pack corrupted while writing to filesystem
packDoesNotMatchIndex=Pack {0} does not match index
packedRefsHandleIsStale=packed-refs handle is stale, {0}. retry
@@ -712,6 +712,7 @@ truncatedHunkOldLinesMissing=Truncated hunk, at least {0} old lines is missing
tSizeMustBeGreaterOrEqual1=tSize must be >= 1
unableToCheckConnectivity=Unable to check connectivity.
unableToCreateNewObject=Unable to create new object: {0}
+unableToReadPackfile=Unable to read packfile {0}
unableToRemovePath=Unable to remove path ''{0}''
unableToStore=Unable to store {0}.
unableToWrite=Unable to write {0}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java
index a24cff1e49..8f884b44f5 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java
@@ -772,6 +772,7 @@ public class JGitText extends TranslationBundle {
/***/ public String tSizeMustBeGreaterOrEqual1;
/***/ public String unableToCheckConnectivity;
/***/ public String unableToCreateNewObject;
+ /***/ public String unableToReadPackfile;
/***/ public String unableToRemovePath;
/***/ public String unableToStore;
/***/ public String unableToWrite;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java
index 7bfec3fd91..015d44e87f 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java
@@ -1270,7 +1270,7 @@ public class GC {
}
private void checkCancelled() throws CancelledException {
- if (pm.isCancelled()) {
+ if (pm.isCancelled() || Thread.currentThread().isInterrupted()) {
throw new CancelledException(JGitText.get().operationCanceled);
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java
index 6be7652436..cd30a3bef3 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java
@@ -360,7 +360,9 @@ public class ObjectDirectory extends FileObjectDatabase {
// The hasObject call should have only touched the index,
// so any failure here indicates the index is unreadable
// by this process, and the pack is likewise not readable.
- LOG.warn("Unable to read packfile " + p.getPackFile(), e);
+ LOG.warn(MessageFormat.format(
+ JGitText.get().unableToReadPackfile,
+ p.getPackFile().getAbsolutePath()), e);
removePack(p);
}
}
@@ -653,7 +655,8 @@ public class ObjectDirectory extends FileObjectDatabase {
if ((e instanceof CorruptObjectException)
|| (e instanceof PackInvalidException)) {
warnTmpl = JGitText.get().corruptPack;
- LOG.warn("Packfile " + p.getPackFile() + " is corrupted", e);
+ LOG.warn(MessageFormat.format(warnTmpl,
+ p.getPackFile().getAbsolutePath()), e);
// Assume the pack is corrupted, and remove it from the list.
removePack(p);
} else if (e instanceof FileNotFoundException) {
@@ -683,8 +686,8 @@ public class ObjectDirectory extends FileObjectDatabase {
// Don't remove the pack from the list, as the error may be
// transient.
LOG.error(MessageFormat.format(errTmpl,
- p.getPackFile().getAbsolutePath()),
- Integer.valueOf(transientErrorCount), e);
+ p.getPackFile().getAbsolutePath(),
+ Integer.valueOf(transientErrorCount)), e);
}
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java
index 71f64ae11f..ed238a40e7 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java
@@ -187,7 +187,9 @@ public class PackFile implements Iterable<PackIndex.MutableEntry> {
} else if (!Arrays.equals(packChecksum, idx.packChecksum)) {
throw new PackMismatchException(MessageFormat.format(
JGitText.get().packChecksumMismatch,
- packFile.getPath()));
+ packFile.getPath(),
+ ObjectId.fromRaw(packChecksum).name(),
+ ObjectId.fromRaw(idx.packChecksum).name()));
}
loadedIdx = idx;
} catch (InterruptedIOException e) {
@@ -753,10 +755,10 @@ public class PackFile implements Iterable<PackIndex.MutableEntry> {
fd.readFully(buf, 0, 20);
if (!Arrays.equals(buf, packChecksum)) {
throw new PackMismatchException(MessageFormat.format(
- JGitText.get().packObjectCountMismatch
- , ObjectId.fromRaw(buf).name()
- , ObjectId.fromRaw(idx.packChecksum).name()
- , getPackFile()));
+ JGitText.get().packChecksumMismatch,
+ getPackFile(),
+ ObjectId.fromRaw(buf).name(),
+ ObjectId.fromRaw(idx.packChecksum).name()));
}
}