diff options
Diffstat (limited to 'org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs')
14 files changed, 26 insertions, 42 deletions
diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/CleanFilter.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/CleanFilter.java index f0526ff8a2..13b74dff7d 100644 --- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/CleanFilter.java +++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/CleanFilter.java @@ -95,7 +95,6 @@ public class CleanFilter extends FilterCommand { this.aOut = new AtomicObjectOutputStream(tmpFile.toAbsolutePath()); } - /** {@inheritDoc} */ @Override public int run() throws IOException { try { diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/LfsPointer.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/LfsPointer.java index 0a8a3faec3..72aad9b0c9 100644 --- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/LfsPointer.java +++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/LfsPointer.java @@ -136,6 +136,7 @@ public class LfsPointer implements Comparable<LfsPointer> { * @return an {@link org.eclipse.jgit.lfs.LfsPointer} or {@code null} if the * stream was not parseable as LfsPointer * @throws java.io.IOException + * if an IO error occurred */ @Nullable public static LfsPointer parseLfsPointer(InputStream in) @@ -264,7 +265,6 @@ public class LfsPointer implements Comparable<LfsPointer> { return VERSION.equals(rest) || VERSION_LEGACY.equals(rest); } - /** {@inheritDoc} */ @Override public String toString() { return "LfsPointer: oid=" + oid.name() + ", size=" //$NON-NLS-1$ //$NON-NLS-2$ @@ -294,7 +294,7 @@ public class LfsPointer implements Comparable<LfsPointer> { if (this == obj) { return true; } - if (obj == null || getClass() != obj.getClass()) { + if (!(obj instanceof LfsPointer)) { return false; } LfsPointer other = (LfsPointer) obj; diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/LfsPrePushHook.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/LfsPrePushHook.java index 9b3d60812a..802835cadd 100644 --- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/LfsPrePushHook.java +++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/LfsPrePushHook.java @@ -246,6 +246,7 @@ public class LfsPrePushHook extends PrePushHook { .getLfsContentConnection(getRepository(), uploadAction, METHOD_PUT); contentServer.setDoOutput(true); + contentServer.setChunkedStreamingMode(256 << 10); try (OutputStream out = contentServer .getOutputStream()) { long size = Files.copy(path, out); diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/Protocol.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/Protocol.java index f9bd1ba0f8..bcfd6e6576 100644 --- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/Protocol.java +++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/Protocol.java @@ -87,6 +87,8 @@ public interface Protocol { } /** Describes an error to be returned by the LFS batch API */ + // TODO(ms): rename this class in next major release + @SuppressWarnings("JavaLangClash") class Error { public int code; @@ -129,6 +131,8 @@ public interface Protocol { String OBJECTS_LFS_ENDPOINT = "/objects/batch"; //$NON-NLS-1$ /** + * Gson instance for handling this protocol + * * @return a {@link Gson} instance suitable for handling this * {@link Protocol} * diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/SmudgeFilter.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/SmudgeFilter.java index c26a1bfbb3..b6515b92e1 100644 --- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/SmudgeFilter.java +++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/SmudgeFilter.java @@ -127,6 +127,7 @@ public class SmudgeFilter extends FilterCommand { * the objects to download * @return the paths of all mediafiles which have been downloaded * @throws IOException + * if an IO error occurred * @since 4.11 */ public static Collection<Path> downloadLfsResource(Lfs lfs, Repository db, @@ -217,7 +218,6 @@ public class SmudgeFilter extends FilterCommand { return downloadedPaths; } - /** {@inheritDoc} */ @Override public int run() throws IOException { try { diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/AtomicObjectOutputStream.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/AtomicObjectOutputStream.java index 3f1f0acac4..009250294e 100644 --- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/AtomicObjectOutputStream.java +++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/AtomicObjectOutputStream.java @@ -45,6 +45,7 @@ public class AtomicObjectOutputStream extends OutputStream { * @param id * a {@link org.eclipse.jgit.lfs.lib.AnyLongObjectId} object. * @throws java.io.IOException + * if an IO error occurred */ public AtomicObjectOutputStream(Path path, AnyLongObjectId id) throws IOException { @@ -61,6 +62,7 @@ public class AtomicObjectOutputStream extends OutputStream { * @param path * a {@link java.nio.file.Path} object. * @throws java.io.IOException + * if an IO error occurred */ public AtomicObjectOutputStream(Path path) throws IOException { this(path, null); @@ -78,25 +80,21 @@ public class AtomicObjectOutputStream extends OutputStream { return id; } - /** {@inheritDoc} */ @Override public void write(int b) throws IOException { out.write(b); } - /** {@inheritDoc} */ @Override public void write(byte[] b) throws IOException { out.write(b); } - /** {@inheritDoc} */ @Override public void write(byte[] b, int off, int len) throws IOException { out.write(b, off, len); } - /** {@inheritDoc} */ @Override public void close() throws IOException { out.close(); diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/LfsConfig.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/LfsConfig.java index 857ccbe056..0469337b1f 100644 --- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/LfsConfig.java +++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/LfsConfig.java @@ -70,6 +70,7 @@ public class LfsConfig { * * @return the delegate {@link Config} * @throws IOException + * if an IO error occurred */ private Config getDelegate() throws IOException { if (delegate == null) { @@ -86,6 +87,7 @@ public class LfsConfig { * @return The loaded lfs config * * @throws IOException + * if an IO error occurred */ private Config load() throws IOException { Config result = null; @@ -114,6 +116,7 @@ public class LfsConfig { * * @return the config, or <code>null</code> * @throws IOException + * if an IO error occurred */ @Nullable private Config loadFromWorkingTree() @@ -139,6 +142,7 @@ public class LfsConfig { * * @return the config, or <code>null</code> if the entry does not exist * @throws IOException + * if an IO error occurred */ @Nullable private Config loadFromIndex() @@ -162,6 +166,7 @@ public class LfsConfig { * * @return the config, or <code>null</code> if the file does not exist * @throws IOException + * if an IO error occurred */ @Nullable private Config loadFromHead() throws IOException { @@ -207,6 +212,7 @@ public class LfsConfig { * the key name * @return a String value from the config, <code>null</code> if not found * @throws IOException + * if an IO error occurred */ @Nullable public String getString(final String section, final String subsection, diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/LfsConnectionFactory.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/LfsConnectionFactory.java index 12b688d157..1a4e85ded6 100644 --- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/LfsConnectionFactory.java +++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/LfsConnectionFactory.java @@ -9,6 +9,7 @@ */ package org.eclipse.jgit.lfs.internal; +import static org.eclipse.jgit.lib.Constants.DEFAULT_REMOTE_NAME; import static org.eclipse.jgit.util.HttpSupport.ENCODING_GZIP; import static org.eclipse.jgit.util.HttpSupport.HDR_ACCEPT; import static org.eclipse.jgit.util.HttpSupport.HDR_ACCEPT_ENCODING; @@ -21,7 +22,7 @@ import java.net.URL; import java.time.LocalDateTime; import java.time.ZoneOffset; import java.time.format.DateTimeFormatter; -import java.util.LinkedList; +import java.util.ArrayList; import java.util.Map; import java.util.TreeMap; @@ -67,6 +68,7 @@ public class LfsConnectionFactory { * @return the connection for the lfs server. e.g. * "https://github.com/github/git-lfs.git/info/lfs" * @throws IOException + * if an IO error occurred */ public static HttpConnection getLfsConnection(Repository db, String method, String purpose) throws IOException { @@ -127,8 +129,7 @@ public class LfsConnectionFactory { // This could be done better (more precise logic), but according // to https://github.com/git-lfs/git-lfs/issues/1759 git-lfs // generally only supports 'origin' in an integrated workflow. - if (lfsUrl == null && (remote.equals( - org.eclipse.jgit.lib.Constants.DEFAULT_REMOTE_NAME))) { + if (lfsUrl == null && remote.equals(DEFAULT_REMOTE_NAME)) { remoteUrl = config.getString( ConfigConstants.CONFIG_KEY_REMOTE, remote, ConfigConstants.CONFIG_KEY_URL); @@ -252,6 +253,8 @@ public class LfsConnectionFactory { } /** + * Create request that can be serialized to JSON + * * @param operation * the operation to perform, e.g. Protocol.OPERATION_DOWNLOAD * @param resources @@ -263,7 +266,7 @@ public class LfsConnectionFactory { Protocol.Request req = new Protocol.Request(); req.operation = operation; if (resources != null) { - req.objects = new LinkedList<>(); + req.objects = new ArrayList<>(); for (LfsPointer res : resources) { Protocol.ObjectSpec o = new Protocol.ObjectSpec(); o.oid = res.getOid().getName(); @@ -287,6 +290,7 @@ public class LfsConnectionFactory { * no timeout can be determined, the token will be used only once. * * @param action + * action with an additional expiration timestamp */ public AuthCache(Protocol.ExpiringAction action) { this.cachedAction = action; diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/LfsText.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/LfsText.java index 8ef8f59f93..00b34ed3ea 100644 --- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/LfsText.java +++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/LfsText.java @@ -15,6 +15,7 @@ import org.eclipse.jgit.nls.TranslationBundle; /** * Translation bundle for JGit LFS server */ +@SuppressWarnings("MissingSummary") public class LfsText extends TranslationBundle { /** diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/AbbreviatedLongObjectId.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/AbbreviatedLongObjectId.java index 9016e53940..7ae805c33f 100644 --- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/AbbreviatedLongObjectId.java +++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/AbbreviatedLongObjectId.java @@ -314,13 +314,11 @@ public final class AbbreviatedLongObjectId implements Serializable { return mask(nibbles, word, v); } - /** {@inheritDoc} */ @Override public int hashCode() { return (int) (w1 >> 32); } - /** {@inheritDoc} */ @Override public boolean equals(Object o) { if (o instanceof AbbreviatedLongObjectId) { @@ -355,7 +353,6 @@ public final class AbbreviatedLongObjectId implements Serializable { return new String(b, 0, nibbles); } - /** {@inheritDoc} */ @SuppressWarnings("nls") @Override public String toString() { diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/AnyLongObjectId.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/AnyLongObjectId.java index d866db4a2d..a13a60c2b8 100644 --- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/AnyLongObjectId.java +++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/AnyLongObjectId.java @@ -41,24 +41,6 @@ public abstract class AnyLongObjectId implements Comparable<AnyLongObjectId> { * @param secondObjectId * the second identifier to compare. Must not be null. * @return true if the two identifiers are the same. - * @deprecated use {@link #isEqual(AnyLongObjectId, AnyLongObjectId)} - * instead. - */ - @Deprecated - @SuppressWarnings("AmbiguousMethodReference") - public static boolean equals(final AnyLongObjectId firstObjectId, - final AnyLongObjectId secondObjectId) { - return isEqual(firstObjectId, secondObjectId); - } - - /** - * Compare two object identifier byte sequences for equality. - * - * @param firstObjectId - * the first identifier to compare. Must not be null. - * @param secondObjectId - * the second identifier to compare. Must not be null. - * @return true if the two identifiers are the same. * @since 5.4 */ public static boolean isEqual(final AnyLongObjectId firstObjectId, @@ -249,7 +231,6 @@ public abstract class AnyLongObjectId implements Comparable<AnyLongObjectId> { return abbr.prefixCompare(this) == 0; } - /** {@inheritDoc} */ @Override public final int hashCode() { return (int) (w1 >> 32); @@ -264,10 +245,9 @@ public abstract class AnyLongObjectId implements Comparable<AnyLongObjectId> { */ @SuppressWarnings({ "NonOverridingEquals", "AmbiguousMethodReference" }) public final boolean equals(AnyLongObjectId other) { - return other != null ? equals(this, other) : false; + return other != null ? isEqual(this, other) : false; } - /** {@inheritDoc} */ @Override public final boolean equals(Object o) { if (o instanceof AnyLongObjectId) { @@ -475,7 +455,6 @@ public abstract class AnyLongObjectId implements Comparable<AnyLongObjectId> { dst[o--] = '0'; } - /** {@inheritDoc} */ @SuppressWarnings("nls") @Override public String toString() { diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/LfsPointerFilter.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/LfsPointerFilter.java index 99bae49abb..75798ca0f1 100644 --- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/LfsPointerFilter.java +++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/LfsPointerFilter.java @@ -41,7 +41,6 @@ public class LfsPointerFilter extends TreeFilter { return pointer; } - /** {@inheritDoc} */ @Override public boolean include(TreeWalk walk) throws MissingObjectException, IncorrectObjectTypeException, IOException { @@ -63,13 +62,11 @@ public class LfsPointerFilter extends TreeFilter { } } - /** {@inheritDoc} */ @Override public boolean shouldBeRecursive() { return false; } - /** {@inheritDoc} */ @Override public TreeFilter clone() { return new LfsPointerFilter(); diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/LongObjectId.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/LongObjectId.java index 15b3ca4c62..3959115462 100644 --- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/LongObjectId.java +++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/LongObjectId.java @@ -256,7 +256,6 @@ public class LongObjectId extends AnyLongObjectId implements Serializable { w4 = src.w4; } - /** {@inheritDoc} */ @Override public LongObjectId toObjectId() { return this; diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/MutableLongObjectId.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/MutableLongObjectId.java index 012e4ae915..5397d8135c 100644 --- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/MutableLongObjectId.java +++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/MutableLongObjectId.java @@ -221,7 +221,6 @@ public class MutableLongObjectId extends AnyLongObjectId { } } - /** {@inheritDoc} */ @Override public LongObjectId toObjectId() { return new LongObjectId(this); |