Merge branch 'master' into next
* master: Revert "Prepend hostname to subsection used to store file timestamp resolution" Remove use of org.bouncycastle.util.encoders.Hex Remove use of org.bouncycastle.util.io.TeeOutputStream Make the IMatcher public API SimilarityRenameDetector: Fix inconsistent indentation Use indexOf(char) and lastIndexOf(char) rather than String versions Reorder modifiers to follow Java Language Specification GitmoduleEntry: Remove redundant import of class from same package Remove redundant "static" qualifier from enum declarations Change-Id: Ie5a3f55229307c900c8974fcaeb1e77c1c87e87f
This commit is contained in:
commit
fb28427499
|
@ -50,7 +50,7 @@ String etag(FileSender sender) throws IOException {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static abstract class PackData extends ObjectFileServlet {
|
private abstract static class PackData extends ObjectFileServlet {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
PackData(String contentType) {
|
PackData(String contentType) {
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class CleanFilter extends FilterCommand {
|
||||||
* The factory is responsible for creating instances of
|
* The factory is responsible for creating instances of
|
||||||
* {@link org.eclipse.jgit.lfs.CleanFilter}
|
* {@link org.eclipse.jgit.lfs.CleanFilter}
|
||||||
*/
|
*/
|
||||||
public final static FilterCommandFactory FACTORY = CleanFilter::new;
|
public static final FilterCommandFactory FACTORY = CleanFilter::new;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers this filter by calling
|
* Registers this filter by calling
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class SmudgeFilter extends FilterCommand {
|
||||||
* The factory is responsible for creating instances of
|
* The factory is responsible for creating instances of
|
||||||
* {@link org.eclipse.jgit.lfs.SmudgeFilter}
|
* {@link org.eclipse.jgit.lfs.SmudgeFilter}
|
||||||
*/
|
*/
|
||||||
public final static FilterCommandFactory FACTORY = SmudgeFilter::new;
|
public static final FilterCommandFactory FACTORY = SmudgeFilter::new;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register this filter in JGit
|
* Register this filter in JGit
|
||||||
|
|
|
@ -317,7 +317,7 @@ private static boolean included(String name, List<String> want) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static abstract class Algorithm {
|
private abstract static class Algorithm {
|
||||||
String name;
|
String name;
|
||||||
|
|
||||||
abstract DiffAlgorithm create();
|
abstract DiffAlgorithm create();
|
||||||
|
|
|
@ -128,11 +128,11 @@ private void assertNotRunning() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static enum StoreType {
|
private enum StoreType {
|
||||||
FS, S3;
|
FS, S3;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static enum StorageClass {
|
private enum StorageClass {
|
||||||
REDUCED_REDUNDANCY, STANDARD
|
REDUCED_REDUNDANCY, STANDARD
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ protected void run() throws Exception {
|
||||||
errw.println();
|
errw.println();
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum Format {
|
enum Format {
|
||||||
/** */
|
/** */
|
||||||
USAGE {
|
USAGE {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -410,7 +410,7 @@ private static class Function {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Base class for any hashCode function to be tested. */
|
/** Base class for any hashCode function to be tested. */
|
||||||
private static abstract class Hash extends RawTextComparator {
|
private abstract static class Hash extends RawTextComparator {
|
||||||
String name;
|
String name;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -420,7 +420,7 @@ public boolean equals(RawText a, int ai, RawText b, int bi) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Base class for any hashCode folding function to be tested. */
|
/** Base class for any hashCode folding function to be tested. */
|
||||||
private static abstract class Fold {
|
private abstract static class Fold {
|
||||||
String name;
|
String name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -18,7 +18,6 @@ Import-Package: com.googlecode.javaewah;version="[1.1.6,2.0.0)",
|
||||||
org.apache.commons.compress.compressors.gzip;version="[1.15.0,2.0)",
|
org.apache.commons.compress.compressors.gzip;version="[1.15.0,2.0)",
|
||||||
org.apache.commons.compress.compressors.xz;version="[1.15.0,2.0)",
|
org.apache.commons.compress.compressors.xz;version="[1.15.0,2.0)",
|
||||||
org.assertj.core.api;version="[3.14.0,4.0.0)",
|
org.assertj.core.api;version="[3.14.0,4.0.0)",
|
||||||
org.bouncycastle.util.encoders;version="[1.61.0,2.0.0)",
|
|
||||||
org.eclipse.jgit.annotations;version="[6.0.0,6.1.0)",
|
org.eclipse.jgit.annotations;version="[6.0.0,6.1.0)",
|
||||||
org.eclipse.jgit.api;version="[6.0.0,6.1.0)",
|
org.eclipse.jgit.api;version="[6.0.0,6.1.0)",
|
||||||
org.eclipse.jgit.api.errors;version="[6.0.0,6.1.0)",
|
org.eclipse.jgit.api.errors;version="[6.0.0,6.1.0)",
|
||||||
|
|
|
@ -152,7 +152,7 @@ void onCommit(String commitId, byte[] buf) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static abstract class CommitReader {
|
abstract static class CommitReader {
|
||||||
private Process proc;
|
private Process proc;
|
||||||
|
|
||||||
CommitReader(String[] args) throws IOException {
|
CommitReader(String[] args) throws IOException {
|
||||||
|
|
|
@ -20,17 +20,17 @@
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class GcOrphanFilesTest extends GcTestCase {
|
public class GcOrphanFilesTest extends GcTestCase {
|
||||||
private final static String PACK = "pack";
|
private static final String PACK = "pack";
|
||||||
|
|
||||||
private final static String BITMAP_File_1 = PACK + "-1.bitmap";
|
private static final String BITMAP_File_1 = PACK + "-1.bitmap";
|
||||||
|
|
||||||
private final static String IDX_File_2 = PACK + "-2.idx";
|
private static final String IDX_File_2 = PACK + "-2.idx";
|
||||||
|
|
||||||
private final static String IDX_File_malformed = PACK + "-1234idx";
|
private static final String IDX_File_malformed = PACK + "-1234idx";
|
||||||
|
|
||||||
private final static String PACK_File_2 = PACK + "-2.pack";
|
private static final String PACK_File_2 = PACK + "-2.pack";
|
||||||
|
|
||||||
private final static String PACK_File_3 = PACK + "-3.pack";
|
private static final String PACK_File_3 = PACK + "-3.pack";
|
||||||
|
|
||||||
private File packDir;
|
private File packDir;
|
||||||
|
|
||||||
|
|
|
@ -305,7 +305,7 @@ public void testReadBoolean_OnOff2() throws ConfigInvalidException {
|
||||||
assertFalse(c.getBoolean("s", "b", true));
|
assertFalse(c.getBoolean("s", "b", true));
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum TestEnum {
|
enum TestEnum {
|
||||||
ONE_TWO;
|
ONE_TWO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ public GitDateParserBadlyFormattedTest(String dateStr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@DataPoints
|
@DataPoints
|
||||||
static public String[] getDataPoints() {
|
public static String[] getDataPoints() {
|
||||||
return new String[] { "", "1970", "3000.3000.3000", "3 yesterday ago",
|
return new String[] { "", "1970", "3000.3000.3000", "3 yesterday ago",
|
||||||
"now yesterday ago", "yesterdays", "3.day. 2.week.ago",
|
"now yesterday ago", "yesterdays", "3.day. 2.week.ago",
|
||||||
"day ago", "Gra Feb 21 15:35:00 2007 +0100",
|
"day ago", "Gra Feb 21 15:35:00 2007 +0100",
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2010, Google Inc.
|
||||||
|
* Copyright (C) 2020 Michael Dardis and others
|
||||||
|
*
|
||||||
|
* This program and the accompanying materials are made available under the
|
||||||
|
* terms of the Eclipse Distribution License v. 1.0 which is available at
|
||||||
|
* https://www.eclipse.org/org/documents/edl-v10.php.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.eclipse.jgit.util;
|
||||||
|
|
||||||
|
import static org.eclipse.jgit.util.Hex.decode;
|
||||||
|
import static org.eclipse.jgit.util.Hex.toHexString;
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
import org.eclipse.jgit.junit.JGitTestUtil;
|
||||||
|
import org.eclipse.jgit.lib.Constants;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class HexTest {
|
||||||
|
@Test
|
||||||
|
public void testEncode() {
|
||||||
|
assertEquals("68690a", toHexString(b("hi\n")));
|
||||||
|
assertEquals("0001020d0a0971", toHexString(b("\0\1\2\r\n\tq")));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDecode() {
|
||||||
|
JGitTestUtil.assertEquals(b("hi\n"), decode("68690a"));
|
||||||
|
JGitTestUtil.assertEquals(b("\0\1\2\r\n\tq"), decode("0001020d0a0971"));
|
||||||
|
JGitTestUtil.assertEquals(b("\u000EB"), decode("0E42"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testEncodeMatchesDecode() {
|
||||||
|
String[] testStrings = { "", "cow", "a", "a secret string",
|
||||||
|
"\0\1\2\r\n\t" };
|
||||||
|
for (String e : testStrings) {
|
||||||
|
JGitTestUtil.assertEquals(b(e), decode(toHexString(b(e))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static byte[] b(String str) {
|
||||||
|
return Constants.encode(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,81 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2020, Michael Dardis. and others
|
||||||
|
*
|
||||||
|
* This program and the accompanying materials are made available under the
|
||||||
|
* terms of the Eclipse Distribution License v. 1.0 which is available at
|
||||||
|
* https://www.eclipse.org/org/documents/edl-v10.php.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
*/
|
||||||
|
package org.eclipse.jgit.util.io;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertArrayEquals;
|
||||||
|
import static org.junit.Assert.assertFalse;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import org.eclipse.jgit.lib.Constants;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class TeeOutputStreamTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test() throws IOException {
|
||||||
|
byte[] data = Constants.encode("Hello World");
|
||||||
|
|
||||||
|
TestOutput first = new TestOutput();
|
||||||
|
TestOutput second = new TestOutput();
|
||||||
|
try (TeeOutputStream tee = new TeeOutputStream(first, second)) {
|
||||||
|
tee.write(data);
|
||||||
|
assertArrayEquals("Stream output must match", first.toByteArray(),
|
||||||
|
second.toByteArray());
|
||||||
|
|
||||||
|
tee.write(1);
|
||||||
|
assertArrayEquals("Stream output must match", first.toByteArray(),
|
||||||
|
second.toByteArray());
|
||||||
|
|
||||||
|
tee.write(data, 1, 4); // Test partial write methods
|
||||||
|
assertArrayEquals("Stream output must match", first.toByteArray(),
|
||||||
|
second.toByteArray());
|
||||||
|
}
|
||||||
|
assertTrue("First stream should be closed", first.closed);
|
||||||
|
assertTrue("Second stream should be closed", second.closed);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCloseException() {
|
||||||
|
TestOutput first = new TestOutput() {
|
||||||
|
@Override
|
||||||
|
public void close() throws IOException {
|
||||||
|
throw new IOException();
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
TestOutput second = new TestOutput();
|
||||||
|
|
||||||
|
@SuppressWarnings("resource")
|
||||||
|
TeeOutputStream tee = new TeeOutputStream(first, second);
|
||||||
|
try {
|
||||||
|
tee.close();
|
||||||
|
} catch (IOException ex) {
|
||||||
|
// Expected from first closed
|
||||||
|
}
|
||||||
|
assertFalse("First stream should not be closed", first.closed);
|
||||||
|
assertTrue("Second stream should still be closed if first close failed",
|
||||||
|
second.closed);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class TestOutput extends ByteArrayOutputStream {
|
||||||
|
|
||||||
|
private boolean closed;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void close() throws IOException {
|
||||||
|
closed = true;
|
||||||
|
super.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -172,7 +172,6 @@ Import-Package: com.googlecode.javaewah;version="[1.1.6,2.0.0)",
|
||||||
org.bouncycastle.openpgp.operator;version="[1.61.0,2.0.0)",
|
org.bouncycastle.openpgp.operator;version="[1.61.0,2.0.0)",
|
||||||
org.bouncycastle.openpgp.operator.jcajce;version="[1.61.0,2.0.0)",
|
org.bouncycastle.openpgp.operator.jcajce;version="[1.61.0,2.0.0)",
|
||||||
org.bouncycastle.util.encoders;version="[1.61.0,2.0.0)",
|
org.bouncycastle.util.encoders;version="[1.61.0,2.0.0)",
|
||||||
org.bouncycastle.util.io;version="[1.61.0,2.0.0)",
|
|
||||||
org.slf4j;version="[1.7.0,2.0.0)",
|
org.slf4j;version="[1.7.0,2.0.0)",
|
||||||
org.xml.sax,
|
org.xml.sax,
|
||||||
org.xml.sax.helpers
|
org.xml.sax.helpers
|
||||||
|
|
|
@ -104,7 +104,7 @@ public class CheckoutCommand extends GitCommand<Ref> {
|
||||||
/**
|
/**
|
||||||
* Stage to check out, see {@link CheckoutCommand#setStage(Stage)}.
|
* Stage to check out, see {@link CheckoutCommand#setStage(Stage)}.
|
||||||
*/
|
*/
|
||||||
public static enum Stage {
|
public enum Stage {
|
||||||
/**
|
/**
|
||||||
* Base stage (#1)
|
* Base stage (#1)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -491,7 +491,7 @@ private int lookupOnly(String pathString) {
|
||||||
int position = Collections.binarySearch(only, p);
|
int position = Collections.binarySearch(only, p);
|
||||||
if (position >= 0)
|
if (position >= 0)
|
||||||
return position;
|
return position;
|
||||||
int l = p.lastIndexOf("/"); //$NON-NLS-1$
|
int l = p.lastIndexOf('/');
|
||||||
if (l < 1)
|
if (l < 1)
|
||||||
break;
|
break;
|
||||||
p = p.substring(0, l);
|
p = p.substring(0, l);
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
*/
|
*/
|
||||||
public class PullCommand extends TransportCommand<PullCommand, PullResult> {
|
public class PullCommand extends TransportCommand<PullCommand, PullResult> {
|
||||||
|
|
||||||
private final static String DOT = "."; //$NON-NLS-1$
|
private static final String DOT = "."; //$NON-NLS-1$
|
||||||
|
|
||||||
private ProgressMonitor monitor = NullProgressMonitor.INSTANCE;
|
private ProgressMonitor monitor = NullProgressMonitor.INSTANCE;
|
||||||
|
|
||||||
|
|
|
@ -800,7 +800,8 @@ private static String composeSquashMessage(boolean isSquash,
|
||||||
sb.append("# This is a combination of ").append(count)
|
sb.append("# This is a combination of ").append(count)
|
||||||
.append(" commits.\n");
|
.append(" commits.\n");
|
||||||
// Add the previous message without header (i.e first line)
|
// Add the previous message without header (i.e first line)
|
||||||
sb.append(currSquashMessage.substring(currSquashMessage.indexOf("\n") + 1));
|
sb.append(currSquashMessage
|
||||||
|
.substring(currSquashMessage.indexOf('\n') + 1));
|
||||||
sb.append("\n");
|
sb.append("\n");
|
||||||
if (isSquash) {
|
if (isSquash) {
|
||||||
sb.append("# This is the ").append(count).append(ordinal)
|
sb.append("# This is the ").append(count).append(ordinal)
|
||||||
|
@ -838,7 +839,7 @@ private static String getOrdinal(int count) {
|
||||||
static int parseSquashFixupSequenceCount(String currSquashMessage) {
|
static int parseSquashFixupSequenceCount(String currSquashMessage) {
|
||||||
String regex = "This is a combination of (.*) commits"; //$NON-NLS-1$
|
String regex = "This is a combination of (.*) commits"; //$NON-NLS-1$
|
||||||
String firstLine = currSquashMessage.substring(0,
|
String firstLine = currSquashMessage.substring(0,
|
||||||
currSquashMessage.indexOf("\n")); //$NON-NLS-1$
|
currSquashMessage.indexOf('\n'));
|
||||||
Pattern pattern = Pattern.compile(regex);
|
Pattern pattern = Pattern.compile(regex);
|
||||||
Matcher matcher = pattern.matcher(firstLine);
|
Matcher matcher = pattern.matcher(firstLine);
|
||||||
if (!matcher.find())
|
if (!matcher.find())
|
||||||
|
|
|
@ -34,7 +34,7 @@ public final class Attribute {
|
||||||
* The attribute value state
|
* The attribute value state
|
||||||
* see also https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
|
* see also https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
|
||||||
*/
|
*/
|
||||||
public static enum State {
|
public enum State {
|
||||||
/** the attribute is set */
|
/** the attribute is set */
|
||||||
SET,
|
SET,
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
*/
|
*/
|
||||||
package org.eclipse.jgit.attributes;
|
package org.eclipse.jgit.attributes;
|
||||||
|
|
||||||
import static org.eclipse.jgit.ignore.internal.IMatcher.NO_MATCH;
|
import static org.eclipse.jgit.ignore.IMatcher.NO_MATCH;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
import org.eclipse.jgit.attributes.Attribute.State;
|
import org.eclipse.jgit.attributes.Attribute.State;
|
||||||
import org.eclipse.jgit.errors.InvalidPatternException;
|
import org.eclipse.jgit.errors.InvalidPatternException;
|
||||||
import org.eclipse.jgit.ignore.FastIgnoreRule;
|
import org.eclipse.jgit.ignore.FastIgnoreRule;
|
||||||
import org.eclipse.jgit.ignore.internal.IMatcher;
|
import org.eclipse.jgit.ignore.IMatcher;
|
||||||
import org.eclipse.jgit.ignore.internal.PathMatcher;
|
import org.eclipse.jgit.ignore.internal.PathMatcher;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -58,7 +58,7 @@ private static List<Attribute> parseAttributes(String attributesLine) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
final int equalsIndex = attribute.indexOf("="); //$NON-NLS-1$
|
final int equalsIndex = attribute.indexOf('=');
|
||||||
if (equalsIndex == -1)
|
if (equalsIndex == -1)
|
||||||
result.add(new Attribute(attribute, State.SET));
|
result.add(new Attribute(attribute, State.SET));
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -26,7 +26,7 @@ public class DiffConfig {
|
||||||
public static final Config.SectionParser<DiffConfig> KEY = DiffConfig::new;
|
public static final Config.SectionParser<DiffConfig> KEY = DiffConfig::new;
|
||||||
|
|
||||||
/** Permissible values for {@code diff.renames}. */
|
/** Permissible values for {@code diff.renames}. */
|
||||||
public static enum RenameDetectionType {
|
public enum RenameDetectionType {
|
||||||
/** Rename detection is disabled. */
|
/** Rename detection is disabled. */
|
||||||
FALSE,
|
FALSE,
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class DiffEntry {
|
||||||
public static final String DEV_NULL = "/dev/null"; //$NON-NLS-1$
|
public static final String DEV_NULL = "/dev/null"; //$NON-NLS-1$
|
||||||
|
|
||||||
/** General type of change a single file-level patch describes. */
|
/** General type of change a single file-level patch describes. */
|
||||||
public static enum ChangeType {
|
public enum ChangeType {
|
||||||
/** Add a new file to the project */
|
/** Add a new file to the project */
|
||||||
ADD,
|
ADD,
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ public static enum ChangeType {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Specify the old or new side for more generalized access. */
|
/** Specify the old or new side for more generalized access. */
|
||||||
public static enum Side {
|
public enum Side {
|
||||||
/** The old side of a DiffEntry. */
|
/** The old side of a DiffEntry. */
|
||||||
OLD,
|
OLD,
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
*/
|
*/
|
||||||
public class Edit {
|
public class Edit {
|
||||||
/** Type of edit */
|
/** Type of edit */
|
||||||
public static enum Type {
|
public enum Type {
|
||||||
/** Sequence B has inserted the region. */
|
/** Sequence B has inserted the region. */
|
||||||
INSERT,
|
INSERT,
|
||||||
|
|
||||||
|
|
|
@ -302,14 +302,14 @@ private int buildMatrix(ProgressMonitor pm)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nameScore(String a, String b) {
|
static int nameScore(String a, String b) {
|
||||||
int aDirLen = a.lastIndexOf("/") + 1; //$NON-NLS-1$
|
int aDirLen = a.lastIndexOf('/') + 1;
|
||||||
int bDirLen = b.lastIndexOf("/") + 1; //$NON-NLS-1$
|
int bDirLen = b.lastIndexOf('/') + 1;
|
||||||
|
|
||||||
int dirMin = Math.min(aDirLen, bDirLen);
|
int dirMin = Math.min(aDirLen, bDirLen);
|
||||||
int dirMax = Math.max(aDirLen, bDirLen);
|
int dirMax = Math.max(aDirLen, bDirLen);
|
||||||
|
|
||||||
final int dirScoreLtr;
|
final int dirScoreLtr;
|
||||||
final int dirScoreRtl;
|
final int dirScoreRtl;
|
||||||
|
|
||||||
if (dirMax == 0) {
|
if (dirMax == 0) {
|
||||||
dirScoreLtr = 100;
|
dirScoreLtr = 100;
|
||||||
|
|
|
@ -30,7 +30,7 @@ public class NoMergeBaseException extends IOException {
|
||||||
* An enum listing the different reason why no merge base could be
|
* An enum listing the different reason why no merge base could be
|
||||||
* determined.
|
* determined.
|
||||||
*/
|
*/
|
||||||
public static enum MergeBaseFailureReason {
|
public enum MergeBaseFailureReason {
|
||||||
/**
|
/**
|
||||||
* Multiple merge bases have been found (e.g. the commits to be merged
|
* Multiple merge bases have been found (e.g. the commits to be merged
|
||||||
* have multiple common predecessors) but the merge strategy doesn't
|
* have multiple common predecessors) but the merge strategy doesn't
|
||||||
|
|
|
@ -45,7 +45,7 @@ protected TranslationBundleException(String message, Class bundleClass, Locale l
|
||||||
*
|
*
|
||||||
* @return bundle class for which the exception occurred
|
* @return bundle class for which the exception occurred
|
||||||
*/
|
*/
|
||||||
final public Class getBundleClass() {
|
public final Class getBundleClass() {
|
||||||
return bundleClass;
|
return bundleClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ final public Class getBundleClass() {
|
||||||
*
|
*
|
||||||
* @return locale for which the exception occurred
|
* @return locale for which the exception occurred
|
||||||
*/
|
*/
|
||||||
final public Locale getLocale() {
|
public final Locale getLocale() {
|
||||||
return locale;
|
return locale;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,11 +17,11 @@
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
import org.bouncycastle.util.io.TeeOutputStream;
|
|
||||||
import org.eclipse.jgit.api.errors.AbortedByHookException;
|
import org.eclipse.jgit.api.errors.AbortedByHookException;
|
||||||
import org.eclipse.jgit.lib.Repository;
|
import org.eclipse.jgit.lib.Repository;
|
||||||
import org.eclipse.jgit.util.FS;
|
import org.eclipse.jgit.util.FS;
|
||||||
import org.eclipse.jgit.util.ProcessResult;
|
import org.eclipse.jgit.util.ProcessResult;
|
||||||
|
import org.eclipse.jgit.util.io.TeeOutputStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Git can fire off custom scripts when certain important actions occur. These
|
* Git can fire off custom scripts when certain important actions occur. These
|
||||||
|
|
|
@ -9,13 +9,12 @@
|
||||||
*/
|
*/
|
||||||
package org.eclipse.jgit.ignore;
|
package org.eclipse.jgit.ignore;
|
||||||
|
|
||||||
import static org.eclipse.jgit.ignore.internal.IMatcher.NO_MATCH;
|
import static org.eclipse.jgit.ignore.IMatcher.NO_MATCH;
|
||||||
import static org.eclipse.jgit.ignore.internal.Strings.isDirectoryPattern;
|
import static org.eclipse.jgit.ignore.internal.Strings.isDirectoryPattern;
|
||||||
import static org.eclipse.jgit.ignore.internal.Strings.stripTrailing;
|
import static org.eclipse.jgit.ignore.internal.Strings.stripTrailing;
|
||||||
import static org.eclipse.jgit.ignore.internal.Strings.stripTrailingWhitespace;
|
import static org.eclipse.jgit.ignore.internal.Strings.stripTrailingWhitespace;
|
||||||
|
|
||||||
import org.eclipse.jgit.errors.InvalidPatternException;
|
import org.eclipse.jgit.errors.InvalidPatternException;
|
||||||
import org.eclipse.jgit.ignore.internal.IMatcher;
|
|
||||||
import org.eclipse.jgit.ignore.internal.PathMatcher;
|
import org.eclipse.jgit.ignore.internal.PathMatcher;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -29,7 +28,7 @@
|
||||||
* @since 3.6
|
* @since 3.6
|
||||||
*/
|
*/
|
||||||
public class FastIgnoreRule {
|
public class FastIgnoreRule {
|
||||||
private final static Logger LOG = LoggerFactory
|
private static final Logger LOG = LoggerFactory
|
||||||
.getLogger(FastIgnoreRule.class);
|
.getLogger(FastIgnoreRule.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2014, 2017 Andrey Loskutov <loskutov@gmx.de> and others
|
* Copyright (C) 2014, 2020 Andrey Loskutov <loskutov@gmx.de> and others
|
||||||
*
|
*
|
||||||
* This program and the accompanying materials are made available under the
|
* This program and the accompanying materials are made available under the
|
||||||
* terms of the Eclipse Distribution License v. 1.0 which is available at
|
* terms of the Eclipse Distribution License v. 1.0 which is available at
|
||||||
|
@ -7,10 +7,16 @@
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
package org.eclipse.jgit.ignore.internal;
|
package org.eclipse.jgit.ignore;
|
||||||
|
|
||||||
|
import org.eclipse.jgit.annotations.NonNull;
|
||||||
|
import org.eclipse.jgit.errors.InvalidPatternException;
|
||||||
|
import org.eclipse.jgit.ignore.internal.PathMatcher;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generic string matcher
|
* Generic path matcher.
|
||||||
|
*
|
||||||
|
* @since 5.7
|
||||||
*/
|
*/
|
||||||
public interface IMatcher {
|
public interface IMatcher {
|
||||||
|
|
||||||
|
@ -18,6 +24,7 @@ public interface IMatcher {
|
||||||
* Matcher that does not match any pattern.
|
* Matcher that does not match any pattern.
|
||||||
*/
|
*/
|
||||||
public static final IMatcher NO_MATCH = new IMatcher() {
|
public static final IMatcher NO_MATCH = new IMatcher() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matches(String path, boolean assumeDirectory,
|
public boolean matches(String path, boolean assumeDirectory,
|
||||||
boolean pathMatch) {
|
boolean pathMatch) {
|
||||||
|
@ -30,6 +37,25 @@ public boolean matches(String segment, int startIncl, int endExcl) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a path matcher for the given pattern. A pattern may contain the
|
||||||
|
* wildcards "?", "*", and "**". The directory separator is '/'.
|
||||||
|
*
|
||||||
|
* @param pattern
|
||||||
|
* to match
|
||||||
|
* @param dirOnly
|
||||||
|
* whether to match only directories
|
||||||
|
* @return a matcher for the given pattern
|
||||||
|
* @throws InvalidPatternException
|
||||||
|
* if the pattern is invalid
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
public static IMatcher createPathMatcher(@NonNull String pattern,
|
||||||
|
boolean dirOnly) throws InvalidPatternException {
|
||||||
|
return PathMatcher.createPathMatcher(pattern,
|
||||||
|
Character.valueOf(FastIgnoreRule.PATH_SEPARATOR), dirOnly);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Matches entire given string
|
* Matches entire given string
|
||||||
*
|
*
|
||||||
|
@ -40,10 +66,7 @@ public boolean matches(String segment, int startIncl, int endExcl) {
|
||||||
* with a slash)
|
* with a slash)
|
||||||
* @param pathMatch
|
* @param pathMatch
|
||||||
* {@code true} if the match is for the full path: prefix-only
|
* {@code true} if the match is for the full path: prefix-only
|
||||||
* matches are not allowed, and
|
* matches are not allowed
|
||||||
* {@link org.eclipse.jgit.ignore.internal.NameMatcher}s must
|
|
||||||
* match only the last component (if they can -- they may not, if
|
|
||||||
* they are anchored at the beginning)
|
|
||||||
* @return true if this matcher pattern matches given string
|
* @return true if this matcher pattern matches given string
|
||||||
*/
|
*/
|
||||||
boolean matches(String path, boolean assumeDirectory, boolean pathMatch);
|
boolean matches(String path, boolean assumeDirectory, boolean pathMatch);
|
|
@ -26,7 +26,7 @@
|
||||||
*/
|
*/
|
||||||
public class IgnoreNode {
|
public class IgnoreNode {
|
||||||
/** Result from {@link IgnoreNode#isIgnored(String, boolean)}. */
|
/** Result from {@link IgnoreNode#isIgnored(String, boolean)}. */
|
||||||
public static enum MatchResult {
|
public enum MatchResult {
|
||||||
/** The file is not ignored, due to a rule saying its not ignored. */
|
/** The file is not ignored, due to a rule saying its not ignored. */
|
||||||
NOT_IGNORED,
|
NOT_IGNORED,
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
*/
|
*/
|
||||||
package org.eclipse.jgit.ignore.internal;
|
package org.eclipse.jgit.ignore.internal;
|
||||||
|
|
||||||
|
import org.eclipse.jgit.ignore.IMatcher;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for default methods as {@link #toString()} and such.
|
* Base class for default methods as {@link #toString()} and such.
|
||||||
* <p>
|
* <p>
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.jgit.errors.InvalidPatternException;
|
import org.eclipse.jgit.errors.InvalidPatternException;
|
||||||
|
import org.eclipse.jgit.ignore.IMatcher;
|
||||||
import org.eclipse.jgit.ignore.internal.Strings.PatternState;
|
import org.eclipse.jgit.ignore.internal.Strings.PatternState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -196,11 +196,11 @@ static PatternState checkWildCards(String pattern) {
|
||||||
return PatternState.COMPLEX;
|
return PatternState.COMPLEX;
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum PatternState {
|
enum PatternState {
|
||||||
LEADING_ASTERISK_ONLY, TRAILING_ASTERISK_ONLY, COMPLEX, NONE
|
LEADING_ASTERISK_ONLY, TRAILING_ASTERISK_ONLY, COMPLEX, NONE
|
||||||
}
|
}
|
||||||
|
|
||||||
final static List<String> POSIX_CHAR_CLASSES = Arrays.asList(
|
static final List<String> POSIX_CHAR_CLASSES = Arrays.asList(
|
||||||
"alnum", "alpha", "blank", "cntrl", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
"alnum", "alpha", "blank", "cntrl", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||||
// [:alnum:] [:alpha:] [:blank:] [:cntrl:]
|
// [:alnum:] [:alpha:] [:blank:] [:cntrl:]
|
||||||
"digit", "graph", "lower", "print", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
"digit", "graph", "lower", "print", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||||
|
@ -215,7 +215,7 @@ static enum PatternState {
|
||||||
|
|
||||||
private static final String DL = "\\p{javaDigit}\\p{javaLetter}"; //$NON-NLS-1$
|
private static final String DL = "\\p{javaDigit}\\p{javaLetter}"; //$NON-NLS-1$
|
||||||
|
|
||||||
final static List<String> JAVA_CHAR_CLASSES = Arrays
|
static final List<String> JAVA_CHAR_CLASSES = Arrays
|
||||||
.asList("\\p{Alnum}", "\\p{javaLetter}", "\\p{Blank}", "\\p{Cntrl}", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
.asList("\\p{Alnum}", "\\p{javaLetter}", "\\p{Blank}", "\\p{Cntrl}", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||||
// [:alnum:] [:alpha:] [:blank:] [:cntrl:]
|
// [:alnum:] [:alpha:] [:blank:] [:cntrl:]
|
||||||
"\\p{javaDigit}", "[\\p{Graph}" + DL + "]", "\\p{Ll}", "[\\p{Print}" + DL + "]", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
|
"\\p{javaDigit}", "[\\p{Graph}" + DL + "]", "\\p{Ll}", "[\\p{Print}" + DL + "]", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
|
||||||
|
@ -228,7 +228,7 @@ static enum PatternState {
|
||||||
|
|
||||||
// Collating symbols [[.a.]] or equivalence class expressions [[=a=]] are
|
// Collating symbols [[.a.]] or equivalence class expressions [[=a=]] are
|
||||||
// not supported by CLI git (at least not by 1.9.1)
|
// not supported by CLI git (at least not by 1.9.1)
|
||||||
final static Pattern UNSUPPORTED = Pattern
|
static final Pattern UNSUPPORTED = Pattern
|
||||||
.compile("\\[\\[[.=]\\w+[.=]\\]\\]"); //$NON-NLS-1$
|
.compile("\\[\\[[.=]\\w+[.=]\\]\\]"); //$NON-NLS-1$
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -93,7 +93,7 @@ public abstract class KetchLeader {
|
||||||
private static final Logger log = LoggerFactory.getLogger(KetchLeader.class);
|
private static final Logger log = LoggerFactory.getLogger(KetchLeader.class);
|
||||||
|
|
||||||
/** Current state of the leader instance. */
|
/** Current state of the leader instance. */
|
||||||
public static enum State {
|
public enum State {
|
||||||
/** Newly created instance trying to elect itself leader. */
|
/** Newly created instance trying to elect itself leader. */
|
||||||
CANDIDATE,
|
CANDIDATE,
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ public void markDirty() {
|
||||||
* comparator based on {@link Enum#compareTo}. Prefer {@link
|
* comparator based on {@link Enum#compareTo}. Prefer {@link
|
||||||
* #DEFAULT_COMPARATOR} or your own {@link ComparatorBuilder}.
|
* #DEFAULT_COMPARATOR} or your own {@link ComparatorBuilder}.
|
||||||
*/
|
*/
|
||||||
public static enum PackSource {
|
public enum PackSource {
|
||||||
/** The pack is created by ObjectInserter due to local activity. */
|
/** The pack is created by ObjectInserter due to local activity. */
|
||||||
INSERT,
|
INSERT,
|
||||||
|
|
||||||
|
@ -672,7 +672,7 @@ public void close() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Snapshot of packs scanned in a single pass. */
|
/** Snapshot of packs scanned in a single pass. */
|
||||||
public static abstract class PackList {
|
public abstract static class PackList {
|
||||||
/** All known packs, sorted. */
|
/** All known packs, sorted. */
|
||||||
public final DfsPackFile[] packs;
|
public final DfsPackFile[] packs;
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
import org.eclipse.jgit.util.FS;
|
import org.eclipse.jgit.util.FS;
|
||||||
|
|
||||||
abstract class FileObjectDatabase extends ObjectDatabase {
|
abstract class FileObjectDatabase extends ObjectDatabase {
|
||||||
static enum InsertLooseObjectResult {
|
enum InsertLooseObjectResult {
|
||||||
INSERTED, EXISTS_PACKED, EXISTS_LOOSE, FAILURE;
|
INSERTED, EXISTS_PACKED, EXISTS_LOOSE, FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@
|
||||||
* adapted to FileRepositories.
|
* adapted to FileRepositories.
|
||||||
*/
|
*/
|
||||||
public class GC {
|
public class GC {
|
||||||
private final static Logger LOG = LoggerFactory
|
private static final Logger LOG = LoggerFactory
|
||||||
.getLogger(GC.class);
|
.getLogger(GC.class);
|
||||||
|
|
||||||
private static final String PRUNE_EXPIRE_DEFAULT = "2.weeks.ago"; //$NON-NLS-1$
|
private static final String PRUNE_EXPIRE_DEFAULT = "2.weeks.ago"; //$NON-NLS-1$
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
* name.
|
* name.
|
||||||
*/
|
*/
|
||||||
public class LockFile {
|
public class LockFile {
|
||||||
private final static Logger LOG = LoggerFactory.getLogger(LockFile.class);
|
private static final Logger LOG = LoggerFactory.getLogger(LockFile.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unlock the given file.
|
* Unlock the given file.
|
||||||
|
|
|
@ -76,7 +76,7 @@
|
||||||
* considered.
|
* considered.
|
||||||
*/
|
*/
|
||||||
public class ObjectDirectory extends FileObjectDatabase {
|
public class ObjectDirectory extends FileObjectDatabase {
|
||||||
private final static Logger LOG = LoggerFactory
|
private static final Logger LOG = LoggerFactory
|
||||||
.getLogger(ObjectDirectory.class);
|
.getLogger(ObjectDirectory.class);
|
||||||
|
|
||||||
private static final PackList NO_PACKS = new PackList(
|
private static final PackList NO_PACKS = new PackList(
|
||||||
|
|
|
@ -70,7 +70,7 @@
|
||||||
* objects are similar.
|
* objects are similar.
|
||||||
*/
|
*/
|
||||||
public class PackFile implements Iterable<PackIndex.MutableEntry> {
|
public class PackFile implements Iterable<PackIndex.MutableEntry> {
|
||||||
private final static Logger LOG = LoggerFactory.getLogger(PackFile.class);
|
private static final Logger LOG = LoggerFactory.getLogger(PackFile.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sorts PackFiles to be most recently created to least recently created.
|
* Sorts PackFiles to be most recently created to least recently created.
|
||||||
|
|
|
@ -97,7 +97,7 @@
|
||||||
* overall size of a Git repository on disk.
|
* overall size of a Git repository on disk.
|
||||||
*/
|
*/
|
||||||
public class RefDirectory extends RefDatabase {
|
public class RefDirectory extends RefDatabase {
|
||||||
private final static Logger LOG = LoggerFactory
|
private static final Logger LOG = LoggerFactory
|
||||||
.getLogger(RefDirectory.class);
|
.getLogger(RefDirectory.class);
|
||||||
|
|
||||||
/** Magic string denoting the start of a symbolic reference file. */
|
/** Magic string denoting the start of a symbolic reference file. */
|
||||||
|
@ -1376,7 +1376,7 @@ private static interface LooseRef extends Ref {
|
||||||
LooseRef peel(ObjectIdRef newLeaf);
|
LooseRef peel(ObjectIdRef newLeaf);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final static class LoosePeeledTag extends ObjectIdRef.PeeledTag
|
private static final class LoosePeeledTag extends ObjectIdRef.PeeledTag
|
||||||
implements LooseRef {
|
implements LooseRef {
|
||||||
private final FileSnapshot snapShot;
|
private final FileSnapshot snapShot;
|
||||||
|
|
||||||
|
@ -1397,7 +1397,7 @@ public LooseRef peel(ObjectIdRef newLeaf) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final static class LooseNonTag extends ObjectIdRef.PeeledNonTag
|
private static final class LooseNonTag extends ObjectIdRef.PeeledNonTag
|
||||||
implements LooseRef {
|
implements LooseRef {
|
||||||
private final FileSnapshot snapShot;
|
private final FileSnapshot snapShot;
|
||||||
|
|
||||||
|
@ -1418,7 +1418,7 @@ public LooseRef peel(ObjectIdRef newLeaf) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final static class LooseUnpeeled extends ObjectIdRef.Unpeeled
|
private static final class LooseUnpeeled extends ObjectIdRef.Unpeeled
|
||||||
implements LooseRef {
|
implements LooseRef {
|
||||||
private FileSnapshot snapShot;
|
private FileSnapshot snapShot;
|
||||||
|
|
||||||
|
@ -1453,7 +1453,7 @@ public LooseRef peel(ObjectIdRef newLeaf) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final static class LooseSymbolicRef extends SymbolicRef implements
|
private static final class LooseSymbolicRef extends SymbolicRef implements
|
||||||
LooseRef {
|
LooseRef {
|
||||||
private final FileSnapshot snapShot;
|
private final FileSnapshot snapShot;
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ public static PackExt[] values() {
|
||||||
* the file extension.
|
* the file extension.
|
||||||
* @return the PackExt for the ext
|
* @return the PackExt for the ext
|
||||||
*/
|
*/
|
||||||
public synchronized static PackExt newPackExt(String ext) {
|
public static synchronized PackExt newPackExt(String ext) {
|
||||||
PackExt[] dst = new PackExt[VALUES.length + 1];
|
PackExt[] dst = new PackExt[VALUES.length + 1];
|
||||||
for (int i = 0; i < VALUES.length; i++) {
|
for (int i = 0; i < VALUES.length; i++) {
|
||||||
PackExt packExt = VALUES[i];
|
PackExt packExt = VALUES[i];
|
||||||
|
|
|
@ -2399,7 +2399,7 @@ State snapshot() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Possible states that a PackWriter can be in. */
|
/** Possible states that a PackWriter can be in. */
|
||||||
public static enum PackingPhase {
|
public enum PackingPhase {
|
||||||
/** Counting objects phase. */
|
/** Counting objects phase. */
|
||||||
COUNTING,
|
COUNTING,
|
||||||
|
|
||||||
|
|
|
@ -253,7 +253,7 @@ static int compare(
|
||||||
return aLen - bLen;
|
return aLen - bLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
static abstract class Entry {
|
abstract static class Entry {
|
||||||
static int compare(Entry ea, Entry eb) {
|
static int compare(Entry ea, Entry eb) {
|
||||||
byte[] a = ea.key;
|
byte[] a = ea.key;
|
||||||
byte[] b = eb.key;
|
byte[] b = eb.key;
|
||||||
|
|
|
@ -47,7 +47,7 @@ public abstract class ReftableDatabase {
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* on I/O problems.
|
* on I/O problems.
|
||||||
*/
|
*/
|
||||||
abstract protected MergedReftable openMergedReftable() throws IOException;
|
protected abstract MergedReftable openMergedReftable() throws IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the next available logical timestamp for an additional reftable
|
* @return the next available logical timestamp for an additional reftable
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class CoreConfig {
|
||||||
public static final Config.SectionParser<CoreConfig> KEY = CoreConfig::new;
|
public static final Config.SectionParser<CoreConfig> KEY = CoreConfig::new;
|
||||||
|
|
||||||
/** Permissible values for {@code core.autocrlf}. */
|
/** Permissible values for {@code core.autocrlf}. */
|
||||||
public static enum AutoCRLF {
|
public enum AutoCRLF {
|
||||||
/** Automatic CRLF->LF conversion is disabled. */
|
/** Automatic CRLF->LF conversion is disabled. */
|
||||||
FALSE,
|
FALSE,
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ public static enum AutoCRLF {
|
||||||
*
|
*
|
||||||
* @since 4.3
|
* @since 4.3
|
||||||
*/
|
*/
|
||||||
public static enum EOL {
|
public enum EOL {
|
||||||
/** Check in with LF, check out with CRLF. */
|
/** Check in with LF, check out with CRLF. */
|
||||||
CRLF,
|
CRLF,
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ public static enum EOL {
|
||||||
*
|
*
|
||||||
* @since 4.3
|
* @since 4.3
|
||||||
*/
|
*/
|
||||||
public static enum EolStreamType {
|
public enum EolStreamType {
|
||||||
/** Convert to CRLF without binary detection. */
|
/** Convert to CRLF without binary detection. */
|
||||||
TEXT_CRLF,
|
TEXT_CRLF,
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ public static enum EolStreamType {
|
||||||
*
|
*
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public static enum CheckStat {
|
public enum CheckStat {
|
||||||
/**
|
/**
|
||||||
* Only check the size and whole second part of time stamp when
|
* Only check the size and whole second part of time stamp when
|
||||||
* comparing the stat info in the dircache with actual file stat info.
|
* comparing the stat info in the dircache with actual file stat info.
|
||||||
|
@ -102,7 +102,7 @@ public static enum CheckStat {
|
||||||
*
|
*
|
||||||
* @since 5.6
|
* @since 5.6
|
||||||
*/
|
*/
|
||||||
public static enum LogRefUpdates {
|
public enum LogRefUpdates {
|
||||||
/** Don't create ref logs; default for bare repositories. */
|
/** Don't create ref logs; default for bare repositories. */
|
||||||
FALSE,
|
FALSE,
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ public static enum LogRefUpdates {
|
||||||
*
|
*
|
||||||
* @since 3.3
|
* @since 3.3
|
||||||
*/
|
*/
|
||||||
public static enum SymLinks {
|
public enum SymLinks {
|
||||||
/** Check out symbolic links as plain files . */
|
/** Check out symbolic links as plain files . */
|
||||||
FALSE,
|
FALSE,
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ public static enum SymLinks {
|
||||||
*
|
*
|
||||||
* @since 3.5
|
* @since 3.5
|
||||||
*/
|
*/
|
||||||
public static enum HideDotFiles {
|
public enum HideDotFiles {
|
||||||
/** Do not hide .files. */
|
/** Do not hide .files. */
|
||||||
FALSE,
|
FALSE,
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,6 @@
|
||||||
*/
|
*/
|
||||||
package org.eclipse.jgit.lib;
|
package org.eclipse.jgit.lib;
|
||||||
|
|
||||||
import org.eclipse.jgit.lib.AnyObjectId;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A .gitmodules file found in the pack. Store the blob of the file itself (e.g.
|
* A .gitmodules file found in the pack. Store the blob of the file itself (e.g.
|
||||||
* to access its contents) and the tree where it was found (e.g. to check if it
|
* to access its contents) and the tree where it was found (e.g. to check if it
|
||||||
|
|
|
@ -75,7 +75,7 @@ public class IndexDiff {
|
||||||
* @see IndexDiff#getConflictingStageStates()
|
* @see IndexDiff#getConflictingStageStates()
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public static enum StageState {
|
public enum StageState {
|
||||||
/**
|
/**
|
||||||
* Exists in base, but neither in ours nor in theirs.
|
* Exists in base, but neither in ours nor in theirs.
|
||||||
*/
|
*/
|
||||||
|
@ -210,11 +210,11 @@ public TreeFilter clone() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final static int TREE = 0;
|
private static final int TREE = 0;
|
||||||
|
|
||||||
private final static int INDEX = 1;
|
private static final int INDEX = 1;
|
||||||
|
|
||||||
private final static int WORKDIR = 2;
|
private static final int WORKDIR = 2;
|
||||||
|
|
||||||
private final Repository repository;
|
private final Repository repository;
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ public static Inflater get() {
|
||||||
return r != null ? r : new Inflater(false);
|
return r != null ? r : new Inflater(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized static Inflater getImpl() {
|
private static synchronized Inflater getImpl() {
|
||||||
if (openInflaterCount > 0) {
|
if (openInflaterCount > 0) {
|
||||||
final Inflater r = inflaterCache[--openInflaterCount];
|
final Inflater r = inflaterCache[--openInflaterCount];
|
||||||
inflaterCache[openInflaterCount] = null;
|
inflaterCache[openInflaterCount] = null;
|
||||||
|
|
|
@ -322,7 +322,7 @@ private static final boolean equals(AnyObjectId firstObjectId,
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Type of entry stored in the {@link ObjectIdOwnerMap}. */
|
/** Type of entry stored in the {@link ObjectIdOwnerMap}. */
|
||||||
public static abstract class Entry extends ObjectId {
|
public abstract static class Entry extends ObjectId {
|
||||||
transient Entry next;
|
transient Entry next;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -65,7 +65,7 @@ public void close() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Wraps a delegate ObjectInserter. */
|
/** Wraps a delegate ObjectInserter. */
|
||||||
public static abstract class Filter extends ObjectInserter {
|
public abstract static class Filter extends ObjectInserter {
|
||||||
/** @return delegate ObjectInserter to handle all processing. */
|
/** @return delegate ObjectInserter to handle all processing. */
|
||||||
protected abstract ObjectInserter delegate();
|
protected abstract ObjectInserter delegate();
|
||||||
|
|
||||||
|
|
|
@ -300,7 +300,7 @@ public ObjectStream openStream() {
|
||||||
*
|
*
|
||||||
* @since 4.10
|
* @since 4.10
|
||||||
*/
|
*/
|
||||||
public static abstract class Filter extends ObjectLoader {
|
public abstract static class Filter extends ObjectLoader {
|
||||||
/**
|
/**
|
||||||
* @return delegate ObjectLoader to handle all processing.
|
* @return delegate ObjectLoader to handle all processing.
|
||||||
* @since 4.10
|
* @since 4.10
|
||||||
|
|
|
@ -462,7 +462,7 @@ public int getStreamFileThreshold() {
|
||||||
*
|
*
|
||||||
* @since 4.4
|
* @since 4.4
|
||||||
*/
|
*/
|
||||||
public static abstract class Filter extends ObjectReader {
|
public abstract static class Filter extends ObjectReader {
|
||||||
/**
|
/**
|
||||||
* @return delegate ObjectReader to handle all processing.
|
* @return delegate ObjectReader to handle all processing.
|
||||||
* @since 4.4
|
* @since 4.4
|
||||||
|
|
|
@ -25,7 +25,7 @@ public class RebaseTodoLine {
|
||||||
* Describes rebase actions
|
* Describes rebase actions
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("nls")
|
@SuppressWarnings("nls")
|
||||||
public static enum Action {
|
public enum Action {
|
||||||
/** Use commit */
|
/** Use commit */
|
||||||
PICK("pick", "p"),
|
PICK("pick", "p"),
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ public String toString() {
|
||||||
* @param token
|
* @param token
|
||||||
* @return the Action
|
* @return the Action
|
||||||
*/
|
*/
|
||||||
static public Action parse(String token) {
|
public static Action parse(String token) {
|
||||||
for (Action action : Action.values()) {
|
for (Action action : Action.values()) {
|
||||||
if (action.token.equals(token)
|
if (action.token.equals(token)
|
||||||
|| action.shortToken.equals(token))
|
|| action.shortToken.equals(token))
|
||||||
|
|
|
@ -33,7 +33,7 @@ public abstract class RefUpdate {
|
||||||
* unknown values are failures, and may generally treat them the same as
|
* unknown values are failures, and may generally treat them the same as
|
||||||
* {@link #REJECTED_OTHER_REASON}.
|
* {@link #REJECTED_OTHER_REASON}.
|
||||||
*/
|
*/
|
||||||
public static enum Result {
|
public enum Result {
|
||||||
/** The ref update/delete has not been attempted by the caller. */
|
/** The ref update/delete has not been attempted by the caller. */
|
||||||
NOT_ATTEMPTED,
|
NOT_ATTEMPTED,
|
||||||
|
|
||||||
|
@ -794,7 +794,7 @@ private static RevObject safeParseOld(RevWalk rw, AnyObjectId oldId)
|
||||||
* Handle the abstraction of storing a ref update. This is because both
|
* Handle the abstraction of storing a ref update. This is because both
|
||||||
* updating and deleting of a ref have merge testing in common.
|
* updating and deleting of a ref have merge testing in common.
|
||||||
*/
|
*/
|
||||||
private static abstract class Store {
|
private abstract static class Store {
|
||||||
abstract Result execute(Result status) throws IOException;
|
abstract Result execute(Result status) throws IOException;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
* Cache of active {@link org.eclipse.jgit.lib.Repository} instances.
|
* Cache of active {@link org.eclipse.jgit.lib.Repository} instances.
|
||||||
*/
|
*/
|
||||||
public class RepositoryCache {
|
public class RepositoryCache {
|
||||||
private final static Logger LOG = LoggerFactory
|
private static final Logger LOG = LoggerFactory
|
||||||
.getLogger(RepositoryCache.class);
|
.getLogger(RepositoryCache.class);
|
||||||
|
|
||||||
private static final RepositoryCache cache = new RepositoryCache();
|
private static final RepositoryCache cache = new RepositoryCache();
|
||||||
|
|
|
@ -50,7 +50,7 @@ public MergeAlgorithm(DiffAlgorithm diff) {
|
||||||
|
|
||||||
// An special edit which acts as a sentinel value by marking the end the
|
// An special edit which acts as a sentinel value by marking the end the
|
||||||
// list of edits
|
// list of edits
|
||||||
private final static Edit END_EDIT = new Edit(Integer.MAX_VALUE,
|
private static final Edit END_EDIT = new Edit(Integer.MAX_VALUE,
|
||||||
Integer.MAX_VALUE);
|
Integer.MAX_VALUE);
|
||||||
|
|
||||||
@SuppressWarnings("ReferenceEquality")
|
@SuppressWarnings("ReferenceEquality")
|
||||||
|
|
|
@ -100,8 +100,8 @@ public static <T extends TranslationBundle> T getBundleFor(Class<T> type) {
|
||||||
return b.get(type);
|
return b.get(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
final private Locale locale;
|
private final Locale locale;
|
||||||
final private ConcurrentHashMap<Class, TranslationBundle> map = new ConcurrentHashMap<>();
|
private final ConcurrentHashMap<Class, TranslationBundle> map = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
private NLS(Locale locale) {
|
private NLS(Locale locale) {
|
||||||
this.locale = locale;
|
this.locale = locale;
|
||||||
|
|
|
@ -25,7 +25,7 @@ public class BinaryHunk {
|
||||||
private static final byte[] DELTA = encodeASCII("delta "); //$NON-NLS-1$
|
private static final byte[] DELTA = encodeASCII("delta "); //$NON-NLS-1$
|
||||||
|
|
||||||
/** Type of information stored in a binary hunk. */
|
/** Type of information stored in a binary hunk. */
|
||||||
public static enum Type {
|
public enum Type {
|
||||||
/** The full content is stored, deflated. */
|
/** The full content is stored, deflated. */
|
||||||
LITERAL_DEFLATED,
|
LITERAL_DEFLATED,
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
* Hunk header for a hunk appearing in a "diff --cc" style patch.
|
* Hunk header for a hunk appearing in a "diff --cc" style patch.
|
||||||
*/
|
*/
|
||||||
public class CombinedHunkHeader extends HunkHeader {
|
public class CombinedHunkHeader extends HunkHeader {
|
||||||
private static abstract class CombinedOldImage extends OldImage {
|
private abstract static class CombinedOldImage extends OldImage {
|
||||||
int nContext;
|
int nContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ public class FileHeader extends DiffEntry {
|
||||||
static final byte[] NEW_NAME = encodeASCII("+++ "); //$NON-NLS-1$
|
static final byte[] NEW_NAME = encodeASCII("+++ "); //$NON-NLS-1$
|
||||||
|
|
||||||
/** Type of patch used by this file. */
|
/** Type of patch used by this file. */
|
||||||
public static enum PatchType {
|
public enum PatchType {
|
||||||
/** A traditional unified diff style patch of a text file. */
|
/** A traditional unified diff style patch of a text file. */
|
||||||
UNIFIED,
|
UNIFIED,
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
*/
|
*/
|
||||||
public class FormatError {
|
public class FormatError {
|
||||||
/** Classification of an error. */
|
/** Classification of an error. */
|
||||||
public static enum Severity {
|
public enum Severity {
|
||||||
/** The error is unexpected, but can be worked around. */
|
/** The error is unexpected, but can be worked around. */
|
||||||
WARNING,
|
WARNING,
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
* The configuration file that is stored in the file of the file system.
|
* The configuration file that is stored in the file of the file system.
|
||||||
*/
|
*/
|
||||||
public class FileBasedConfig extends StoredConfig {
|
public class FileBasedConfig extends StoredConfig {
|
||||||
private final static Logger LOG = LoggerFactory
|
private static final Logger LOG = LoggerFactory
|
||||||
.getLogger(FileBasedConfig.class);
|
.getLogger(FileBasedConfig.class);
|
||||||
|
|
||||||
private final File configFile;
|
private final File configFile;
|
||||||
|
|
|
@ -358,7 +358,7 @@ private void readStatusReport(Map<String, RemoteRefUpdate> refUpdates)
|
||||||
refNameEnd = refLine.length();
|
refNameEnd = refLine.length();
|
||||||
} else if (refLine.startsWith("ng ")) { //$NON-NLS-1$
|
} else if (refLine.startsWith("ng ")) { //$NON-NLS-1$
|
||||||
ok = false;
|
ok = false;
|
||||||
refNameEnd = refLine.indexOf(" ", 3); //$NON-NLS-1$
|
refNameEnd = refLine.indexOf(' ', 3);
|
||||||
}
|
}
|
||||||
if (refNameEnd == -1)
|
if (refNameEnd == -1)
|
||||||
throw new PackProtocolException(MessageFormat.format(JGitText.get().unexpectedReportLine2
|
throw new PackProtocolException(MessageFormat.format(JGitText.get().unexpectedReportLine2
|
||||||
|
|
|
@ -247,7 +247,7 @@ public final class GitProtocolConstants {
|
||||||
*/
|
*/
|
||||||
public static final String COMMAND_FETCH = "fetch"; //$NON-NLS-1$
|
public static final String COMMAND_FETCH = "fetch"; //$NON-NLS-1$
|
||||||
|
|
||||||
static enum MultiAck {
|
enum MultiAck {
|
||||||
OFF, CONTINUE, DETAILED;
|
OFF, CONTINUE, DETAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ public abstract class PackParser {
|
||||||
private static final int BUFFER_SIZE = 8192;
|
private static final int BUFFER_SIZE = 8192;
|
||||||
|
|
||||||
/** Location data is being obtained from. */
|
/** Location data is being obtained from. */
|
||||||
public static enum Source {
|
public enum Source {
|
||||||
/** Data is read from the incoming stream. */
|
/** Data is read from the incoming stream. */
|
||||||
INPUT,
|
INPUT,
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class PacketLineIn {
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static final String DELIM = new StringBuilder(0).toString(); /* must not string pool */
|
public static final String DELIM = new StringBuilder(0).toString(); /* must not string pool */
|
||||||
|
|
||||||
static enum AckNackResult {
|
enum AckNackResult {
|
||||||
/** NAK */
|
/** NAK */
|
||||||
NAK,
|
NAK,
|
||||||
/** ACK */
|
/** ACK */
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
*/
|
*/
|
||||||
public class ReceiveCommand {
|
public class ReceiveCommand {
|
||||||
/** Type of operation requested. */
|
/** Type of operation requested. */
|
||||||
public static enum Type {
|
public enum Type {
|
||||||
/** Create a new ref; the ref must not already exist. */
|
/** Create a new ref; the ref must not already exist. */
|
||||||
CREATE,
|
CREATE,
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ public static enum Type {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Result of the update command. */
|
/** Result of the update command. */
|
||||||
public static enum Result {
|
public enum Result {
|
||||||
/** The command has not yet been attempted by the server. */
|
/** The command has not yet been attempted by the server. */
|
||||||
NOT_ATTEMPTED,
|
NOT_ATTEMPTED,
|
||||||
|
|
||||||
|
|
|
@ -1937,7 +1937,7 @@ private void release() throws IOException {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Interface for reporting status messages. */
|
/** Interface for reporting status messages. */
|
||||||
static abstract class Reporter {
|
abstract static class Reporter {
|
||||||
abstract void sendString(String s) throws IOException;
|
abstract void sendString(String s) throws IOException;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class RemoteRefUpdate {
|
||||||
/**
|
/**
|
||||||
* Represent current status of a remote ref update.
|
* Represent current status of a remote ref update.
|
||||||
*/
|
*/
|
||||||
public static enum Status {
|
public enum Status {
|
||||||
/**
|
/**
|
||||||
* Push process hasn't yet attempted to update this ref. This is the
|
* Push process hasn't yet attempted to update this ref. This is the
|
||||||
* default status, prior to push process execution.
|
* default status, prior to push process execution.
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
*/
|
*/
|
||||||
public abstract class TransportProtocol {
|
public abstract class TransportProtocol {
|
||||||
/** Fields within a {@link URIish} that a transport uses. */
|
/** Fields within a {@link URIish} that a transport uses. */
|
||||||
public static enum URIishField {
|
public enum URIishField {
|
||||||
/** the user field */
|
/** the user field */
|
||||||
USER,
|
USER,
|
||||||
/** the pass (aka password) field */
|
/** the pass (aka password) field */
|
||||||
|
|
|
@ -104,7 +104,7 @@
|
||||||
*/
|
*/
|
||||||
public class UploadPack {
|
public class UploadPack {
|
||||||
/** Policy the server uses to validate client requests */
|
/** Policy the server uses to validate client requests */
|
||||||
public static enum RequestPolicy {
|
public enum RequestPolicy {
|
||||||
/** Client may only ask for objects the server advertised a reference for. */
|
/** Client may only ask for objects the server advertised a reference for. */
|
||||||
ADVERTISED,
|
ADVERTISED,
|
||||||
|
|
||||||
|
|
|
@ -34,9 +34,9 @@
|
||||||
import javax.crypto.spec.PBEParameterSpec;
|
import javax.crypto.spec.PBEParameterSpec;
|
||||||
import javax.crypto.spec.SecretKeySpec;
|
import javax.crypto.spec.SecretKeySpec;
|
||||||
|
|
||||||
import org.bouncycastle.util.encoders.Hex;
|
|
||||||
import org.eclipse.jgit.internal.JGitText;
|
import org.eclipse.jgit.internal.JGitText;
|
||||||
import org.eclipse.jgit.util.Base64;
|
import org.eclipse.jgit.util.Base64;
|
||||||
|
import org.eclipse.jgit.util.Hex;
|
||||||
|
|
||||||
abstract class WalkEncryption {
|
abstract class WalkEncryption {
|
||||||
static final WalkEncryption NONE = new NoEncryption();
|
static final WalkEncryption NONE = new NoEncryption();
|
||||||
|
@ -294,7 +294,7 @@ static GeneralSecurityException securityError(String message,
|
||||||
* Base implementation of JGit symmetric encryption. Supports V2 properties
|
* Base implementation of JGit symmetric encryption. Supports V2 properties
|
||||||
* format.
|
* format.
|
||||||
*/
|
*/
|
||||||
static abstract class SymmetricEncryption extends WalkEncryption
|
abstract static class SymmetricEncryption extends WalkEncryption
|
||||||
implements Keys, Vals {
|
implements Keys, Vals {
|
||||||
|
|
||||||
/** Encryption profile, root name of group of related properties. */
|
/** Encryption profile, root name of group of related properties. */
|
||||||
|
|
|
@ -242,7 +242,7 @@ public static class DefaultFileModeStrategy implements FileModeStrategy {
|
||||||
/**
|
/**
|
||||||
* a singleton instance of the default FileModeStrategy
|
* a singleton instance of the default FileModeStrategy
|
||||||
*/
|
*/
|
||||||
public final static DefaultFileModeStrategy INSTANCE =
|
public static final DefaultFileModeStrategy INSTANCE =
|
||||||
new DefaultFileModeStrategy();
|
new DefaultFileModeStrategy();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -275,7 +275,7 @@ public static class NoGitlinksStrategy implements FileModeStrategy {
|
||||||
/**
|
/**
|
||||||
* a singleton instance of the default FileModeStrategy
|
* a singleton instance of the default FileModeStrategy
|
||||||
*/
|
*/
|
||||||
public final static NoGitlinksStrategy INSTANCE = new NoGitlinksStrategy();
|
public static final NoGitlinksStrategy INSTANCE = new NoGitlinksStrategy();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FileMode getMode(File f, FS.Attributes attributes) {
|
public FileMode getMode(File f, FS.Attributes attributes) {
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class TreeWalk implements AutoCloseable, AttributesProvider {
|
||||||
/**
|
/**
|
||||||
* @since 4.2
|
* @since 4.2
|
||||||
*/
|
*/
|
||||||
public static enum OperationType {
|
public enum OperationType {
|
||||||
/**
|
/**
|
||||||
* Represents a checkout operation (for example a checkout or reset
|
* Represents a checkout operation (for example a checkout or reset
|
||||||
* operation).
|
* operation).
|
||||||
|
|
|
@ -1147,7 +1147,7 @@ private byte[] computeHash(InputStream in, long length) throws IOException {
|
||||||
*
|
*
|
||||||
* @since 5.0
|
* @since 5.0
|
||||||
*/
|
*/
|
||||||
public static abstract class Entry {
|
public abstract static class Entry {
|
||||||
byte[] encodedName;
|
byte[] encodedName;
|
||||||
|
|
||||||
int encodedNameLen;
|
int encodedNameLen;
|
||||||
|
|
|
@ -28,26 +28,26 @@
|
||||||
*/
|
*/
|
||||||
public class Base64 {
|
public class Base64 {
|
||||||
/** The equals sign (=) as a byte. */
|
/** The equals sign (=) as a byte. */
|
||||||
private final static byte EQUALS_SIGN = (byte) '=';
|
private static final byte EQUALS_SIGN = (byte) '=';
|
||||||
|
|
||||||
/** Indicates equals sign in encoding. */
|
/** Indicates equals sign in encoding. */
|
||||||
private final static byte EQUALS_SIGN_DEC = -1;
|
private static final byte EQUALS_SIGN_DEC = -1;
|
||||||
|
|
||||||
/** Indicates white space in encoding. */
|
/** Indicates white space in encoding. */
|
||||||
private final static byte WHITE_SPACE_DEC = -2;
|
private static final byte WHITE_SPACE_DEC = -2;
|
||||||
|
|
||||||
/** Indicates an invalid byte during decoding. */
|
/** Indicates an invalid byte during decoding. */
|
||||||
private final static byte INVALID_DEC = -3;
|
private static final byte INVALID_DEC = -3;
|
||||||
|
|
||||||
/** The 64 valid Base64 values. */
|
/** The 64 valid Base64 values. */
|
||||||
private final static byte[] ENC;
|
private static final byte[] ENC;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Translates a Base64 value to either its 6-bit reconstruction value or a
|
* Translates a Base64 value to either its 6-bit reconstruction value or a
|
||||||
* negative number indicating some other meaning. The table is only 7 bits
|
* negative number indicating some other meaning. The table is only 7 bits
|
||||||
* wide, as the 8th bit is discarded during decoding.
|
* wide, as the 8th bit is discarded during decoding.
|
||||||
*/
|
*/
|
||||||
private final static byte[] DEC;
|
private static final byte[] DEC;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
ENC = ("ABCDEFGHIJKLMNOPQRSTUVWXYZ" // //$NON-NLS-1$
|
ENC = ("ABCDEFGHIJKLMNOPQRSTUVWXYZ" // //$NON-NLS-1$
|
||||||
|
|
|
@ -148,7 +148,7 @@ public static String insertId(String message, ObjectId changeId,
|
||||||
ret.append(CHANGE_ID);
|
ret.append(CHANGE_ID);
|
||||||
ret.append(" I"); //$NON-NLS-1$
|
ret.append(" I"); //$NON-NLS-1$
|
||||||
ret.append(ObjectId.toString(changeId));
|
ret.append(ObjectId.toString(changeId));
|
||||||
int indexOfNextLineBreak = message.indexOf("\n", //$NON-NLS-1$
|
int indexOfNextLineBreak = message.indexOf('\n',
|
||||||
indexOfChangeId);
|
indexOfChangeId);
|
||||||
if (indexOfNextLineBreak > 0)
|
if (indexOfNextLineBreak > 0)
|
||||||
ret.append(message.substring(indexOfNextLineBreak));
|
ret.append(message.substring(indexOfNextLineBreak));
|
||||||
|
|
|
@ -184,7 +184,7 @@ public int getRc() {
|
||||||
*
|
*
|
||||||
* @since 5.1.9
|
* @since 5.1.9
|
||||||
*/
|
*/
|
||||||
public final static class FileStoreAttributes {
|
public static final class FileStoreAttributes {
|
||||||
|
|
||||||
private static final Duration UNDEFINED_DURATION = Duration
|
private static final Duration UNDEFINED_DURATION = Duration
|
||||||
.ofNanos(Long.MAX_VALUE);
|
.ofNanos(Long.MAX_VALUE);
|
||||||
|
@ -204,9 +204,8 @@ public final static class FileStoreAttributes {
|
||||||
public static final FileStoreAttributes FALLBACK_FILESTORE_ATTRIBUTES = new FileStoreAttributes(
|
public static final FileStoreAttributes FALLBACK_FILESTORE_ATTRIBUTES = new FileStoreAttributes(
|
||||||
FALLBACK_TIMESTAMP_RESOLUTION);
|
FALLBACK_TIMESTAMP_RESOLUTION);
|
||||||
|
|
||||||
private static final String JAVA_VERSION_PREFIX = SystemReader
|
private static final String JAVA_VERSION_PREFIX = System
|
||||||
.getInstance().getHostname() + '|'
|
.getProperty("java.vendor") + '|' //$NON-NLS-1$
|
||||||
+ System.getProperty("java.vendor") + '|' //$NON-NLS-1$
|
|
||||||
+ System.getProperty("java.version") + '|'; //$NON-NLS-1$
|
+ System.getProperty("java.version") + '|'; //$NON-NLS-1$
|
||||||
|
|
||||||
private static final Duration FALLBACK_MIN_RACY_INTERVAL = Duration
|
private static final Duration FALLBACK_MIN_RACY_INTERVAL = Duration
|
||||||
|
@ -691,7 +690,7 @@ public String toString() {
|
||||||
/** The auto-detected implementation selected for this operating system and JRE. */
|
/** The auto-detected implementation selected for this operating system and JRE. */
|
||||||
public static final FS DETECTED = detect();
|
public static final FS DETECTED = detect();
|
||||||
|
|
||||||
private volatile static FSFactory factory;
|
private static volatile FSFactory factory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Auto-detect the appropriate file system abstraction.
|
* Auto-detect the appropriate file system abstraction.
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public class FS_POSIX extends FS {
|
public class FS_POSIX extends FS {
|
||||||
private final static Logger LOG = LoggerFactory.getLogger(FS_POSIX.class);
|
private static final Logger LOG = LoggerFactory.getLogger(FS_POSIX.class);
|
||||||
|
|
||||||
private static final int DEFAULT_UMASK = 0022;
|
private static final int DEFAULT_UMASK = 0022;
|
||||||
private volatile int umask = -1;
|
private volatile int umask = -1;
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public class FS_Win32 extends FS {
|
public class FS_Win32 extends FS {
|
||||||
private final static Logger LOG = LoggerFactory.getLogger(FS_Win32.class);
|
private static final Logger LOG = LoggerFactory.getLogger(FS_Win32.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public class FS_Win32_Cygwin extends FS_Win32 {
|
public class FS_Win32_Cygwin extends FS_Win32 {
|
||||||
private final static Logger LOG = LoggerFactory
|
private static final Logger LOG = LoggerFactory
|
||||||
.getLogger(FS_Win32_Cygwin.class);
|
.getLogger(FS_Win32_Cygwin.class);
|
||||||
|
|
||||||
private static String cygpath;
|
private static String cygpath;
|
||||||
|
|
|
@ -35,7 +35,7 @@ public class GitDateFormatter {
|
||||||
/**
|
/**
|
||||||
* Git and JGit formats
|
* Git and JGit formats
|
||||||
*/
|
*/
|
||||||
static public enum Format {
|
public enum Format {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Git format: Time and original time zone
|
* Git format: Time and original time zone
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2020, Michael Dardis. and others
|
||||||
|
*
|
||||||
|
* This program and the accompanying materials are made available under the
|
||||||
|
* terms of the Eclipse Distribution License v. 1.0 which is available at
|
||||||
|
* https://www.eclipse.org/org/documents/edl-v10.php.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.eclipse.jgit.util;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Encodes and decodes to and from hexadecimal notation.
|
||||||
|
*
|
||||||
|
* @since 5.7
|
||||||
|
*/
|
||||||
|
public final class Hex {
|
||||||
|
|
||||||
|
private static final char[] HEX = "0123456789abcdef".toCharArray(); //$NON-NLS-1$
|
||||||
|
|
||||||
|
/** Defeats instantiation. */
|
||||||
|
private Hex() {
|
||||||
|
// empty
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decode a hexadecimal string to a byte array.
|
||||||
|
*
|
||||||
|
* Note this method performs no validation on input content.
|
||||||
|
*
|
||||||
|
* @param s hexadecimal string
|
||||||
|
* @return decoded array
|
||||||
|
*/
|
||||||
|
public static byte[] decode(String s) {
|
||||||
|
int len = s.length();
|
||||||
|
byte[] b = new byte[len / 2];
|
||||||
|
|
||||||
|
for (int i = 0; i < len; i += 2) {
|
||||||
|
b[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4) | Character.digit(s.charAt(i + 1), 16));
|
||||||
|
}
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Encode a byte array to a hexadecimal string.
|
||||||
|
*
|
||||||
|
* @param b byte array
|
||||||
|
* @return hexadecimal string
|
||||||
|
*/
|
||||||
|
public static String toHexString(byte[] b) {
|
||||||
|
char[] c = new char[b.length * 2];
|
||||||
|
|
||||||
|
for (int i = 0; i < b.length; i++) {
|
||||||
|
int v = b[i] & 0xFF;
|
||||||
|
|
||||||
|
c[i * 2] = HEX[v >>> 4];
|
||||||
|
c[i * 2 + 1] = HEX[v & 0x0F];
|
||||||
|
}
|
||||||
|
|
||||||
|
return new String(c);
|
||||||
|
}
|
||||||
|
}
|
|
@ -33,7 +33,7 @@
|
||||||
* @since 5.1.13
|
* @since 5.1.13
|
||||||
*/
|
*/
|
||||||
public class Monitoring {
|
public class Monitoring {
|
||||||
private final static Logger LOG = LoggerFactory.getLogger(Monitoring.class);
|
private static final Logger LOG = LoggerFactory.getLogger(Monitoring.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a MBean with the platform MBean server
|
* Register a MBean with the platform MBean server
|
||||||
|
|
|
@ -18,7 +18,7 @@ public class ProcessResult {
|
||||||
/**
|
/**
|
||||||
* Status of a process' execution.
|
* Status of a process' execution.
|
||||||
*/
|
*/
|
||||||
public static enum Status {
|
public enum Status {
|
||||||
/**
|
/**
|
||||||
* The script was found and launched properly. It may still have exited
|
* The script was found and launched properly. It may still have exited
|
||||||
* with a non-zero {@link #exitCode}.
|
* with a non-zero {@link #exitCode}.
|
||||||
|
|
|
@ -19,19 +19,19 @@
|
||||||
* in the format defined by {@code git log --relative-date}.
|
* in the format defined by {@code git log --relative-date}.
|
||||||
*/
|
*/
|
||||||
public class RelativeDateFormatter {
|
public class RelativeDateFormatter {
|
||||||
final static long SECOND_IN_MILLIS = 1000;
|
static final long SECOND_IN_MILLIS = 1000;
|
||||||
|
|
||||||
final static long MINUTE_IN_MILLIS = 60 * SECOND_IN_MILLIS;
|
static final long MINUTE_IN_MILLIS = 60 * SECOND_IN_MILLIS;
|
||||||
|
|
||||||
final static long HOUR_IN_MILLIS = 60 * MINUTE_IN_MILLIS;
|
static final long HOUR_IN_MILLIS = 60 * MINUTE_IN_MILLIS;
|
||||||
|
|
||||||
final static long DAY_IN_MILLIS = 24 * HOUR_IN_MILLIS;
|
static final long DAY_IN_MILLIS = 24 * HOUR_IN_MILLIS;
|
||||||
|
|
||||||
final static long WEEK_IN_MILLIS = 7 * DAY_IN_MILLIS;
|
static final long WEEK_IN_MILLIS = 7 * DAY_IN_MILLIS;
|
||||||
|
|
||||||
final static long MONTH_IN_MILLIS = 30 * DAY_IN_MILLIS;
|
static final long MONTH_IN_MILLIS = 30 * DAY_IN_MILLIS;
|
||||||
|
|
||||||
final static long YEAR_IN_MILLIS = 365 * DAY_IN_MILLIS;
|
static final long YEAR_IN_MILLIS = 365 * DAY_IN_MILLIS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get age of given {@link java.util.Date} compared to now formatted in the
|
* Get age of given {@link java.util.Date} compared to now formatted in the
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
*/
|
*/
|
||||||
public abstract class SystemReader {
|
public abstract class SystemReader {
|
||||||
|
|
||||||
private final static Logger LOG = LoggerFactory
|
private static final Logger LOG = LoggerFactory
|
||||||
.getLogger(SystemReader.class);
|
.getLogger(SystemReader.class);
|
||||||
|
|
||||||
private static final SystemReader DEFAULT;
|
private static final SystemReader DEFAULT;
|
||||||
|
|
|
@ -0,0 +1,74 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2020, Michael Dardis. and others
|
||||||
|
*
|
||||||
|
* This program and the accompanying materials are made available under the
|
||||||
|
* terms of the Eclipse Distribution License v. 1.0 which is available at
|
||||||
|
* https://www.eclipse.org/org/documents/edl-v10.php.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.eclipse.jgit.util.io;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An output stream that writes all data to two streams.
|
||||||
|
*
|
||||||
|
* @since 5.7
|
||||||
|
*/
|
||||||
|
public class TeeOutputStream extends OutputStream {
|
||||||
|
|
||||||
|
private final OutputStream stream1;
|
||||||
|
private final OutputStream stream2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize a tee output stream.
|
||||||
|
*
|
||||||
|
* @param stream1 first output stream
|
||||||
|
* @param stream2 second output stream
|
||||||
|
*/
|
||||||
|
public TeeOutputStream(OutputStream stream1, OutputStream stream2) {
|
||||||
|
this.stream1 = stream1;
|
||||||
|
this.stream2 = stream2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@Override
|
||||||
|
public void write(byte[] buf) throws IOException {
|
||||||
|
this.stream1.write(buf);
|
||||||
|
this.stream2.write(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@Override
|
||||||
|
public void write(byte[] buf, int off, int len) throws IOException {
|
||||||
|
this.stream1.write(buf, off, len);
|
||||||
|
this.stream2.write(buf, off, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@Override
|
||||||
|
public void write(int b) throws IOException {
|
||||||
|
this.stream1.write(b);
|
||||||
|
this.stream2.write(b);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@Override
|
||||||
|
public void flush() throws IOException {
|
||||||
|
this.stream1.flush();
|
||||||
|
this.stream2.flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@Override
|
||||||
|
public void close() throws IOException {
|
||||||
|
try {
|
||||||
|
this.stream1.close();
|
||||||
|
} finally {
|
||||||
|
this.stream2.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue