aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.junit/src/org
diff options
context:
space:
mode:
authorZhen Chen <czhen@google.com>2017-06-20 15:22:09 -0700
committerZhen Chen <czhen@google.com>2017-07-26 10:12:29 -0700
commit2c2999643f64c25a1db1d664c5f563c878559ef2 (patch)
tree232dca08c3f7361de0f78a691b84419d90149bf4 /org.eclipse.jgit.junit/src/org
parent82f68500c0dfedd98e0769888a46eff7899c5ab7 (diff)
downloadjgit-2c2999643f64c25a1db1d664c5f563c878559ef2.tar.gz
jgit-2c2999643f64c25a1db1d664c5f563c878559ef2.zip
Add dfs fsck implementation
JGit already had some fsck-like classes like ObjectChecker which can check for an individual object. The read-only FsckPackParser which will parse all objects within a pack file and check it with ObjectChecker. It will also check the pack index file against the object information from the pack parser. Change-Id: Ifd8e0d28eb68ff0b8edd2b51b2fa3a50a544c855 Signed-off-by: Zhen Chen <czhen@google.com>
Diffstat (limited to 'org.eclipse.jgit.junit/src/org')
-rw-r--r--org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/JGitTestUtil.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/JGitTestUtil.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/JGitTestUtil.java
index 2962e7192f..5bf61f0e83 100644
--- a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/JGitTestUtil.java
+++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/JGitTestUtil.java
@@ -258,4 +258,27 @@ public abstract class JGitTestUtil {
target);
}
+ /**
+ * Concatenate byte arrays.
+ *
+ * @param b
+ * byte arrays to combine together.
+ * @return a single byte array that contains all bytes copied from input
+ * byte arrays.
+ * @since 4.9
+ */
+ public static byte[] concat(byte[]... b) {
+ int n = 0;
+ for (byte[] a : b) {
+ n += a.length;
+ }
+
+ byte[] data = new byte[n];
+ n = 0;
+ for (byte[] a : b) {
+ System.arraycopy(a, 0, data, n, a.length);
+ n += a.length;
+ }
+ return data;
+ }
}