aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java36
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java1
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/MergedReftable.java24
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java120
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java42
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevObject.java1
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevSort.java12
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java11
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/revwalk/StartGenerator.java12
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/revwalk/TopoNonIntermixSortGenerator.java117
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileRepositoryBuilder.java2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackConfig.java118
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/http/HttpConnection.java14
14 files changed, 446 insertions, 66 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java
index 78afe18f39..30d7f9adc4 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java
@@ -89,6 +89,8 @@ public class CloneCommand extends TransportCommand<CloneCommand, Git> {
private FETCH_TYPE fetchType;
+ private TagOpt tagOption;
+
private enum FETCH_TYPE {
MULTIPLE_BRANCHES, ALL_BRANCHES, MIRROR
}
@@ -278,6 +280,9 @@ public class CloneCommand extends TransportCommand<CloneCommand, Git> {
config.setFetchRefSpecs(calculateRefSpecs(fetchType, config.getName()));
config.setMirror(fetchType == FETCH_TYPE.MIRROR);
+ if (tagOption != null) {
+ config.setTagOpt(tagOption);
+ }
config.update(clonedRepo.getConfig());
clonedRepo.getConfig().save();
@@ -286,7 +291,12 @@ public class CloneCommand extends TransportCommand<CloneCommand, Git> {
FetchCommand command = new FetchCommand(clonedRepo);
command.setRemote(remote);
command.setProgressMonitor(monitor);
- command.setTagOpt(fetchAll ? TagOpt.FETCH_TAGS : TagOpt.AUTO_FOLLOW);
+ if (tagOption != null) {
+ command.setTagOpt(tagOption);
+ } else {
+ command.setTagOpt(
+ fetchAll ? TagOpt.FETCH_TAGS : TagOpt.AUTO_FOLLOW);
+ }
configure(command);
return command.call();
@@ -664,6 +674,30 @@ public class CloneCommand extends TransportCommand<CloneCommand, Git> {
}
/**
+ * Set the tag option used for the remote configuration explicitly.
+ *
+ * @param tagOption
+ * tag option to be used for the remote config
+ * @return {@code this}
+ * @since 5.8
+ */
+ public CloneCommand setTagOption(TagOpt tagOption) {
+ this.tagOption = tagOption;
+ return this;
+ }
+
+ /**
+ * Set the --no-tags option. Tags are not cloned now and the remote
+ * configuration is initialized with the --no-tags option as well.
+ *
+ * @return {@code this}
+ * @since 5.8
+ */
+ public CloneCommand setNoTags() {
+ return setTagOption(TagOpt.NO_TAGS);
+ }
+
+ /**
* Set whether to skip checking out a branch
*
* @param noCheckout
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java
index 6235dd83d9..ec2414d41b 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java
@@ -82,6 +82,7 @@ public class JGitText extends TranslationBundle {
/***/ public String cannotCheckoutFromUnbornBranch;
/***/ public String cannotCheckoutOursSwitchBranch;
/***/ public String cannotCombineSquashWithNoff;
+ /***/ public String cannotCombineTopoSortWithTopoKeepBranchTogetherSort;
/***/ public String cannotCombineTreeFilterWithRevFilter;
/***/ public String cannotCommitOnARepoWithState;
/***/ public String cannotCommitWriteTo;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/MergedReftable.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/MergedReftable.java
index 18c013fd8d..36335153a1 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/MergedReftable.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/MergedReftable.java
@@ -61,8 +61,16 @@ public class MergedReftable extends Reftable {
*/
@Override
public long maxUpdateIndex() throws IOException {
- return tables.length > 0 ? tables[tables.length - 1].maxUpdateIndex()
- : 0;
+ if (tables.length == 0) {
+ return 0;
+ }
+ long maxUpdateIndex = tables[tables.length - 1].maxUpdateIndex();
+ for (int i = tables.length - 2; i >= 0; i--) {
+ if (maxUpdateIndex < tables[i].maxUpdateIndex()) {
+ maxUpdateIndex = tables[i].maxUpdateIndex();
+ }
+ }
+ return maxUpdateIndex;
}
/**
@@ -70,8 +78,16 @@ public class MergedReftable extends Reftable {
*/
@Override
public long minUpdateIndex() throws IOException {
- return tables.length > 0 ? tables[0].minUpdateIndex()
- : 0;
+ if (tables.length == 0) {
+ return 0;
+ }
+ long minUpdateIndex = tables[0].minUpdateIndex();
+ for (int i = 0; i < tables.length - 1; i++) {
+ if (tables[i].minUpdateIndex() < minUpdateIndex) {
+ minUpdateIndex = tables[i].minUpdateIndex();
+ }
+ }
+ return minUpdateIndex;
}
/** {@inheritDoc} */
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java
index e607edc2ea..eef822fa4b 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java
@@ -542,4 +542,124 @@ public final class ConfigConstants {
* @since 5.1.13
*/
public static final String CONFIG_JMX_SECTION = "jmx";
+
+ /**
+ * The "pack.bigfilethreshold" key
+ * @since 5.8
+ */
+ public static final String CONFIG_KEY_BIGFILE_THRESHOLD = "bigfilethreshold";
+
+ /**
+ * The "pack.bitmapContiguousCommitCount" key
+ * @since 5.8
+ */
+ public static final String CONFIG_KEY_BITMAP_CONTIGUOUS_COMMIT_COUNT = "bitmapcontiguouscommitcount";
+
+ /**
+ * The "pack.bitmapDistantCommitSpan" key
+ * @since 5.8
+ */
+ public static final String CONFIG_KEY_BITMAP_DISTANT_COMMIT_SPAN = "bitmapdistantcommitspan";
+
+ /**
+ * The "pack.bitmapExcessiveBranchCount" key
+ * @since 5.8
+ */
+ public static final String CONFIG_KEY_BITMAP_EXCESSIVE_BRANCH_COUNT = "bitmapexcessivebranchcount";
+
+ /**
+ * The "pack.bitmapInactiveBranchAgeInDays" key
+ * @since 5.8
+ */
+ public static final String CONFIG_KEY_BITMAP_INACTIVE_BRANCH_AGE_INDAYS = "bitmapinactivebranchageindays";
+
+ /**
+ * The "pack.bitmapRecentCommitSpan" key
+ * @since 5.8
+ */
+ public static final String CONFIG_KEY_BITMAP_RECENT_COMMIT_COUNT = "bitmaprecentcommitspan";
+
+ /**
+ * The "pack.buildBitmaps" key
+ * @since 5.8
+ */
+ public static final String CONFIG_KEY_BUILD_BITMAPS = "buildbitmaps";
+
+ /**
+ * The "pack.cutDeltaChains" key
+ * @since 5.8
+ */
+ public static final String CONFIG_KEY_CUT_DELTACHAINS = "cutdeltachains";
+
+ /**
+ * The "pack.deltaCacheLimit" key
+ * @since 5.8
+ */
+ public static final String CONFIG_KEY_DELTA_CACHE_LIMIT = "deltacachelimit";
+
+ /**
+ * The "pack.deltaCacheSize" key
+ * @since 5.8
+ */
+ public static final String CONFIG_KEY_DELTA_CACHE_SIZE = "deltacachesize";
+
+ /**
+ * The "pack.deltaCompression" key
+ * @since 5.8
+ */
+ public static final String CONFIG_KEY_DELTA_COMPRESSION = "deltacompression";
+
+ /**
+ * The "pack.depth" key
+ * @since 5.8
+ */
+ public static final String CONFIG_KEY_DEPTH = "depth";
+
+ /**
+ * The "pack.minSizePreventRacyPack" key
+ * @since 5.8
+ */
+ public static final String CONFIG_KEY_MIN_SIZE_PREVENT_RACYPACK = "minsizepreventracypack";
+
+ /**
+ * The "pack.reuseDeltas" key
+ * @since 5.8
+ */
+ public static final String CONFIG_KEY_REUSE_DELTAS = "reusedeltas";
+
+ /**
+ * The "pack.reuseObjects" key
+ * @since 5.8
+ */
+ public static final String CONFIG_KEY_REUSE_OBJECTS = "reuseobjects";
+
+ /**
+ * The "pack.singlePack" key
+ * @since 5.8
+ */
+ public static final String CONFIG_KEY_SINGLE_PACK = "singlepack";
+
+ /**
+ * The "pack.threads" key
+ * @since 5.8
+ */
+ public static final String CONFIG_KEY_THREADS = "threads";
+
+ /**
+ * The "pack.waitPreventRacyPack" key
+ * @since 5.8
+ */
+ public static final String CONFIG_KEY_WAIT_PREVENT_RACYPACK = "waitpreventracypack";
+
+ /**
+ * The "pack.window" key
+ * @since 5.8
+ */
+ public static final String CONFIG_KEY_WINDOW = "window";
+
+ /**
+ * The "pack.windowMemory" key
+ * @since 5.8
+ */
+ public static final String CONFIG_KEY_WINDOW_MEMORY = "windowmemory";
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java
index 575e7bd285..506d333120 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java
@@ -789,27 +789,37 @@ public class ResolveMerger extends ThreeWayMerger {
MergeResult<RawText> result = contentMerge(base, ours, theirs,
attributes);
- add(tw.getRawPath(), base, DirCacheEntry.STAGE_1, EPOCH, 0);
- add(tw.getRawPath(), ours, DirCacheEntry.STAGE_2, EPOCH, 0);
- DirCacheEntry e = add(tw.getRawPath(), theirs,
- DirCacheEntry.STAGE_3, EPOCH, 0);
+ if (ignoreConflicts) {
+ // In case a conflict is detected the working tree file is
+ // again filled with new content (containing conflict
+ // markers). But also stage 0 of the index is filled with
+ // that content.
+ result.setContainsConflicts(false);
+ updateIndex(base, ours, theirs, result, attributes);
+ } else {
+ add(tw.getRawPath(), base, DirCacheEntry.STAGE_1, EPOCH, 0);
+ add(tw.getRawPath(), ours, DirCacheEntry.STAGE_2, EPOCH, 0);
+ DirCacheEntry e = add(tw.getRawPath(), theirs,
+ DirCacheEntry.STAGE_3, EPOCH, 0);
- // OURS was deleted checkout THEIRS
- if (modeO == 0) {
- // Check worktree before checking out THEIRS
- if (isWorktreeDirty(work, ourDce))
- return false;
- if (nonTree(modeT)) {
- if (e != null) {
- addToCheckout(tw.getPathString(), e, attributes);
+ // OURS was deleted checkout THEIRS
+ if (modeO == 0) {
+ // Check worktree before checking out THEIRS
+ if (isWorktreeDirty(work, ourDce)) {
+ return false;
+ }
+ if (nonTree(modeT)) {
+ if (e != null) {
+ addToCheckout(tw.getPathString(), e, attributes);
+ }
}
}
- }
- unmergedPaths.add(tw.getPathString());
+ unmergedPaths.add(tw.getPathString());
- // generate a MergeResult for the deleted file
- mergeResults.put(tw.getPathString(), result);
+ // generate a MergeResult for the deleted file
+ mergeResults.put(tw.getPathString(), result);
+ }
}
}
return true;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevObject.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevObject.java
index 5ce4bc33b5..4d2684a0f0 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevObject.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevObject.java
@@ -152,6 +152,7 @@ public abstract class RevObject extends ObjectIdOwnerMap.Entry {
*/
protected void appendCoreFlags(StringBuilder s) {
s.append((flags & RevWalk.TOPO_DELAY) != 0 ? 'o' : '-');
+ s.append((flags & RevWalk.TOPO_QUEUED) != 0 ? 'q' : '-');
s.append((flags & RevWalk.TEMP_MARK) != 0 ? 't' : '-');
s.append((flags & RevWalk.REWRITE) != 0 ? 'r' : '-');
s.append((flags & RevWalk.UNINTERESTING) != 0 ? 'u' : '-');
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevSort.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevSort.java
index fc6ae28dc9..08396a8061 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevSort.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevSort.java
@@ -40,6 +40,18 @@ public enum RevSort {
TOPO,
/**
+ * Topological sorting (all children before parents) without intermixing
+ * lines of history.
+ * <p>
+ * This behavior more closely resembles C Git's git-log --topo-order than
+ * {@link #TOPO}. See C Git's topo-order <a href=
+ * "https://git-scm.com/docs/git-log#Documentation/git-log.txt---topo-order">description</a>.
+ *
+ * @since 5.8
+ */
+ TOPO_KEEP_BRANCH_TOGETHER,
+
+ /**
* Flip the output into the reverse ordering.
* <p>
* This strategy can be combined with the others described by this type as
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java
index f425e87618..6b62fcdf6d 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java
@@ -131,8 +131,17 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {
*/
static final int TOPO_DELAY = 1 << 5;
+ /**
+ * Temporary mark for use within {@link TopoNonIntermixSortGenerator}.
+ * <p>
+ * This mark indicates the commit has been queued for emission in
+ * {@link TopoSortGenerator} and can be produced. This mark is removed when
+ * the commit has been produced.
+ */
+ static final int TOPO_QUEUED = 1 << 6;
+
/** Number of flag bits we keep internal for our own use. See above flags. */
- static final int RESERVED_FLAGS = 6;
+ static final int RESERVED_FLAGS = 7;
private static final int APP_FLAGS = -1 & ~((1 << RESERVED_FLAGS) - 1);
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/StartGenerator.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/StartGenerator.java
index 2c1b0a59ee..bfcea6ea8f 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/StartGenerator.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/StartGenerator.java
@@ -135,8 +135,18 @@ class StartGenerator extends Generator {
}
if (walker.hasRevSort(RevSort.TOPO)
- && (g.outputType() & SORT_TOPO) == 0)
+ && walker.hasRevSort(RevSort.TOPO_KEEP_BRANCH_TOGETHER)) {
+ throw new IllegalStateException(JGitText
+ .get().cannotCombineTopoSortWithTopoKeepBranchTogetherSort);
+ }
+
+ if (walker.hasRevSort(RevSort.TOPO)
+ && (g.outputType() & SORT_TOPO) == 0) {
g = new TopoSortGenerator(g);
+ } else if (walker.hasRevSort(RevSort.TOPO_KEEP_BRANCH_TOGETHER)
+ && (g.outputType() & SORT_TOPO) == 0) {
+ g = new TopoNonIntermixSortGenerator(g);
+ }
if (walker.hasRevSort(RevSort.REVERSE))
g = new LIFORevQueue(g);
if (boundary)
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/TopoNonIntermixSortGenerator.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/TopoNonIntermixSortGenerator.java
new file mode 100644
index 0000000000..4f6d417ed1
--- /dev/null
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/TopoNonIntermixSortGenerator.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2020, Google LLC. 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.revwalk;
+
+import java.io.IOException;
+
+import org.eclipse.jgit.errors.IncorrectObjectTypeException;
+import org.eclipse.jgit.errors.MissingObjectException;
+
+/** Sorts commits in topological order without intermixing lines of history. */
+class TopoNonIntermixSortGenerator extends Generator {
+ private static final int TOPO_QUEUED = RevWalk.TOPO_QUEUED;
+
+ private final FIFORevQueue pending;
+
+ private final int outputType;
+
+ /**
+ * Create a new sorter and completely spin the generator.
+ * <p>
+ * When the constructor completes the supplied generator will have no
+ * commits remaining, as all of the commits will be held inside of this
+ * generator's internal buffer.
+ *
+ * @param s
+ * generator to pull all commits out of, and into this buffer.
+ * @throws MissingObjectException
+ * @throws IncorrectObjectTypeException
+ * @throws IOException
+ */
+ TopoNonIntermixSortGenerator(Generator s) throws MissingObjectException,
+ IncorrectObjectTypeException, IOException {
+ super(s.firstParent);
+ pending = new FIFORevQueue(firstParent);
+ outputType = s.outputType() | SORT_TOPO;
+ s.shareFreeList(pending);
+ for (;;) {
+ final RevCommit c = s.next();
+ if (c == null) {
+ break;
+ }
+ if ((c.flags & TOPO_QUEUED) == 0) {
+ for (RevCommit p : c.parents) {
+ p.inDegree++;
+
+ if (firstParent) {
+ break;
+ }
+ }
+ }
+ c.flags |= TOPO_QUEUED;
+ pending.add(c);
+ }
+ }
+
+ @Override
+ int outputType() {
+ return outputType;
+ }
+
+ @Override
+ void shareFreeList(BlockRevQueue q) {
+ q.shareFreeList(pending);
+ }
+
+ @Override
+ RevCommit next() throws MissingObjectException,
+ IncorrectObjectTypeException, IOException {
+ for (;;) {
+ final RevCommit c = pending.next();
+ if (c == null) {
+ return null;
+ }
+
+ if (c.inDegree > 0) {
+ // At least one of our children is missing. We delay
+ // production until all of our children are output.
+ //
+ continue;
+ }
+
+ if ((c.flags & TOPO_QUEUED) == 0) {
+ // c is a parent that already produced or a parent that
+ // was never in the priority queue and should never produce.
+ //
+ continue;
+ }
+
+ for (RevCommit p : c.parents) {
+ if (--p.inDegree == 0 && (p.flags & TOPO_QUEUED) != 0) {
+ // The parent has no unproduced interesting children. unpop
+ // the parent so it goes right behind this child. This means
+ // that this parent commit may appear in "pending" more than
+ // once, but this is safe since upon the second and
+ // subsequent iterations with this commit, it will no longer
+ // have TOPO_QUEUED set, and thus will be skipped.
+ //
+ pending.unpop(p);
+ }
+ if (firstParent) {
+ break;
+ }
+ }
+
+ c.flags &= ~TOPO_QUEUED;
+ return c;
+ }
+ }
+}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileRepositoryBuilder.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileRepositoryBuilder.java
index 553d875bba..d476a0d2fb 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileRepositoryBuilder.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileRepositoryBuilder.java
@@ -32,7 +32,7 @@ import org.eclipse.jgit.lib.Repository;
* <pre>
* new FileRepositoryBuilder() //
* .setGitDir(gitDirArgument) // --git-dir if supplied, no-op if null
- * .readEnviroment() // scan environment GIT_* variables
+ * .readEnvironment() // scan environment GIT_* variables
* .findGitDir() // scan up the file system tree
* .build()
* </pre>
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackConfig.java
index 259f011757..f76dd2721f 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackConfig.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackConfig.java
@@ -11,6 +11,31 @@
package org.eclipse.jgit.storage.pack;
+import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_CORE_SECTION;
+import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_BIGFILE_THRESHOLD;
+import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_BITMAP_CONTIGUOUS_COMMIT_COUNT;
+import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_BITMAP_DISTANT_COMMIT_SPAN;
+import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_BITMAP_EXCESSIVE_BRANCH_COUNT;
+import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_BITMAP_INACTIVE_BRANCH_AGE_INDAYS;
+import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_BITMAP_RECENT_COMMIT_COUNT;
+import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_BUILD_BITMAPS;
+import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_COMPRESSION;
+import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_CUT_DELTACHAINS;
+import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_DELTA_CACHE_LIMIT;
+import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_DELTA_CACHE_SIZE;
+import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_DELTA_COMPRESSION;
+import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_DEPTH;
+import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_INDEXVERSION;
+import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_MIN_SIZE_PREVENT_RACYPACK;
+import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_REUSE_DELTAS;
+import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_REUSE_OBJECTS;
+import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_SINGLE_PACK;
+import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_THREADS;
+import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_WAIT_PREVENT_RACYPACK;
+import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_WINDOW;
+import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_WINDOW_MEMORY;
+import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_PACK_SECTION;
+
import java.util.concurrent.Executor;
import java.util.zip.Deflater;
@@ -1101,52 +1126,63 @@ public class PackConfig {
* configuration to read properties from.
*/
public void fromConfig(Config rc) {
- setMaxDeltaDepth(rc.getInt("pack", "depth", getMaxDeltaDepth())); //$NON-NLS-1$ //$NON-NLS-2$
- setDeltaSearchWindowSize(rc.getInt(
- "pack", "window", getDeltaSearchWindowSize())); //$NON-NLS-1$ //$NON-NLS-2$
- setDeltaSearchMemoryLimit(rc.getLong(
- "pack", "windowmemory", getDeltaSearchMemoryLimit())); //$NON-NLS-1$ //$NON-NLS-2$
- setDeltaCacheSize(rc.getLong(
- "pack", "deltacachesize", getDeltaCacheSize())); //$NON-NLS-1$ //$NON-NLS-2$
- setDeltaCacheLimit(rc.getInt(
- "pack", "deltacachelimit", getDeltaCacheLimit())); //$NON-NLS-1$ //$NON-NLS-2$
- setCompressionLevel(rc.getInt("pack", "compression", //$NON-NLS-1$ //$NON-NLS-2$
- rc.getInt("core", "compression", getCompressionLevel()))); //$NON-NLS-1$ //$NON-NLS-2$
- setIndexVersion(rc.getInt("pack", "indexversion", getIndexVersion())); //$NON-NLS-1$ //$NON-NLS-2$
- setBigFileThreshold(rc.getInt(
- "core", "bigfilethreshold", getBigFileThreshold())); //$NON-NLS-1$ //$NON-NLS-2$
- setThreads(rc.getInt("pack", "threads", getThreads())); //$NON-NLS-1$ //$NON-NLS-2$
+ setMaxDeltaDepth(rc.getInt(CONFIG_PACK_SECTION, CONFIG_KEY_DEPTH,
+ getMaxDeltaDepth()));
+ setDeltaSearchWindowSize(rc.getInt(CONFIG_PACK_SECTION,
+ CONFIG_KEY_WINDOW, getDeltaSearchWindowSize()));
+ setDeltaSearchMemoryLimit(rc.getLong(CONFIG_PACK_SECTION,
+ CONFIG_KEY_WINDOW_MEMORY, getDeltaSearchMemoryLimit()));
+ setDeltaCacheSize(rc.getLong(CONFIG_PACK_SECTION,
+ CONFIG_KEY_DELTA_CACHE_SIZE, getDeltaCacheSize()));
+ setDeltaCacheLimit(rc.getInt(CONFIG_PACK_SECTION,
+ CONFIG_KEY_DELTA_CACHE_LIMIT, getDeltaCacheLimit()));
+ setCompressionLevel(rc.getInt(CONFIG_PACK_SECTION,
+ CONFIG_KEY_COMPRESSION, rc.getInt(CONFIG_CORE_SECTION,
+ CONFIG_KEY_COMPRESSION, getCompressionLevel())));
+ setIndexVersion(rc.getInt(CONFIG_PACK_SECTION,
+ CONFIG_KEY_INDEXVERSION,
+ getIndexVersion()));
+ setBigFileThreshold(rc.getInt(CONFIG_CORE_SECTION,
+ CONFIG_KEY_BIGFILE_THRESHOLD, getBigFileThreshold()));
+ setThreads(rc.getInt(CONFIG_PACK_SECTION, CONFIG_KEY_THREADS,
+ getThreads()));
// These variables aren't standardized
- //
- setReuseDeltas(rc.getBoolean("pack", "reusedeltas", isReuseDeltas())); //$NON-NLS-1$ //$NON-NLS-2$
- setReuseObjects(
- rc.getBoolean("pack", "reuseobjects", isReuseObjects())); //$NON-NLS-1$ //$NON-NLS-2$
- setDeltaCompress(
- rc.getBoolean("pack", "deltacompression", isDeltaCompress())); //$NON-NLS-1$ //$NON-NLS-2$
- setCutDeltaChains(
- rc.getBoolean("pack", "cutdeltachains", getCutDeltaChains())); //$NON-NLS-1$ //$NON-NLS-2$
- setSinglePack(
- rc.getBoolean("pack", "singlepack", getSinglePack())); //$NON-NLS-1$ //$NON-NLS-2$
- setBuildBitmaps(
- rc.getBoolean("pack", "buildbitmaps", isBuildBitmaps())); //$NON-NLS-1$ //$NON-NLS-2$
- setBitmapContiguousCommitCount(
- rc.getInt("pack", "bitmapcontiguouscommitcount", //$NON-NLS-1$ //$NON-NLS-2$
- getBitmapContiguousCommitCount()));
- setBitmapRecentCommitCount(rc.getInt("pack", "bitmaprecentcommitcount", //$NON-NLS-1$ //$NON-NLS-2$
+ setReuseDeltas(rc.getBoolean(CONFIG_PACK_SECTION,
+ CONFIG_KEY_REUSE_DELTAS, isReuseDeltas()));
+ setReuseObjects(rc.getBoolean(CONFIG_PACK_SECTION,
+ CONFIG_KEY_REUSE_OBJECTS, isReuseObjects()));
+ setDeltaCompress(rc.getBoolean(CONFIG_PACK_SECTION,
+ CONFIG_KEY_DELTA_COMPRESSION, isDeltaCompress()));
+ setCutDeltaChains(rc.getBoolean(CONFIG_PACK_SECTION,
+ CONFIG_KEY_CUT_DELTACHAINS, getCutDeltaChains()));
+ setSinglePack(rc.getBoolean(CONFIG_PACK_SECTION,
+ CONFIG_KEY_SINGLE_PACK,
+ getSinglePack()));
+ setBuildBitmaps(rc.getBoolean(CONFIG_PACK_SECTION,
+ CONFIG_KEY_BUILD_BITMAPS, isBuildBitmaps()));
+ setBitmapContiguousCommitCount(rc.getInt(CONFIG_PACK_SECTION,
+ CONFIG_KEY_BITMAP_CONTIGUOUS_COMMIT_COUNT,
+ getBitmapContiguousCommitCount()));
+ setBitmapRecentCommitCount(rc.getInt(CONFIG_PACK_SECTION,
+ CONFIG_KEY_BITMAP_RECENT_COMMIT_COUNT,
getBitmapRecentCommitCount()));
- setBitmapRecentCommitSpan(rc.getInt("pack", "bitmaprecentcommitspan", //$NON-NLS-1$ //$NON-NLS-2$
+ setBitmapRecentCommitSpan(rc.getInt(CONFIG_PACK_SECTION,
+ CONFIG_KEY_BITMAP_RECENT_COMMIT_COUNT,
getBitmapRecentCommitSpan()));
- setBitmapDistantCommitSpan(rc.getInt("pack", "bitmapdistantcommitspan", //$NON-NLS-1$ //$NON-NLS-2$
+ setBitmapDistantCommitSpan(rc.getInt(CONFIG_PACK_SECTION,
+ CONFIG_KEY_BITMAP_DISTANT_COMMIT_SPAN,
getBitmapDistantCommitSpan()));
- setBitmapExcessiveBranchCount(rc.getInt("pack", //$NON-NLS-1$
- "bitmapexcessivebranchcount", getBitmapExcessiveBranchCount())); //$NON-NLS-1$
- setBitmapInactiveBranchAgeInDays(
- rc.getInt("pack", "bitmapinactivebranchageindays", //$NON-NLS-1$ //$NON-NLS-2$
- getBitmapInactiveBranchAgeInDays()));
- setWaitPreventRacyPack(rc.getBoolean("pack", "waitpreventracypack", //$NON-NLS-1$ //$NON-NLS-2$
- isWaitPreventRacyPack()));
- setMinSizePreventRacyPack(rc.getLong("pack", "minsizepreventracypack", //$NON-NLS-1$//$NON-NLS-2$
+ setBitmapExcessiveBranchCount(rc.getInt(CONFIG_PACK_SECTION,
+ CONFIG_KEY_BITMAP_EXCESSIVE_BRANCH_COUNT,
+ getBitmapExcessiveBranchCount()));
+ setBitmapInactiveBranchAgeInDays(rc.getInt(CONFIG_PACK_SECTION,
+ CONFIG_KEY_BITMAP_INACTIVE_BRANCH_AGE_INDAYS,
+ getBitmapInactiveBranchAgeInDays()));
+ setWaitPreventRacyPack(rc.getBoolean(CONFIG_PACK_SECTION,
+ CONFIG_KEY_WAIT_PREVENT_RACYPACK, isWaitPreventRacyPack()));
+ setMinSizePreventRacyPack(rc.getLong(CONFIG_PACK_SECTION,
+ CONFIG_KEY_MIN_SIZE_PREVENT_RACYPACK,
getMinSizePreventRacyPack()));
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java
index 356f88d918..c3c1f2a405 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java
@@ -549,6 +549,7 @@ public class TransportHttp extends HttpTransport implements WalkTransport,
case HttpConnection.HTTP_MOVED_PERM:
case HttpConnection.HTTP_MOVED_TEMP:
case HttpConnection.HTTP_SEE_OTHER:
+ case HttpConnection.HTTP_11_MOVED_PERM:
case HttpConnection.HTTP_11_MOVED_TEMP:
// SEE_OTHER should actually never be sent by a git server,
// and in general should occur only on POST requests. But it
@@ -1412,6 +1413,7 @@ public class TransportHttp extends HttpTransport implements WalkTransport,
case HttpConnection.HTTP_MOVED_PERM:
case HttpConnection.HTTP_MOVED_TEMP:
+ case HttpConnection.HTTP_11_MOVED_PERM:
case HttpConnection.HTTP_11_MOVED_TEMP:
// SEE_OTHER after a POST doesn't make sense for a git
// server, so we don't handle it here and thus we'll
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/http/HttpConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/http/HttpConnection.java
index a5f2bc605d..c4d086d4bd 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/http/HttpConnection.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/http/HttpConnection.java
@@ -59,14 +59,26 @@ public interface HttpConnection {
int HTTP_SEE_OTHER = java.net.HttpURLConnection.HTTP_SEE_OTHER;
/**
- * HTTP 1.1 additional MOVED_TEMP status code; value = 307.
+ * HTTP 1.1 additional "temporary redirect" status code; value = 307.
*
* @see #HTTP_MOVED_TEMP
+ * @see <a href="https://tools.ietf.org/html/rfc7231#section-6.4.7">RFC
+ * 7231, section 6.4.7: 307 Temporary Redirect</a>
* @since 4.9
*/
int HTTP_11_MOVED_TEMP = 307;
/**
+ * HTTP 1.1 additional "permanent redirect" status code; value = 308.
+ *
+ * @see #HTTP_MOVED_TEMP
+ * @see <a href="https://tools.ietf.org/html/rfc7538#section-3">RFC 7538,
+ * section 3: 308 Permanent Redirect</a>
+ * @since 5.8
+ */
+ int HTTP_11_MOVED_PERM = 308;
+
+ /**
* @see HttpURLConnection#HTTP_NOT_FOUND
*/
int HTTP_NOT_FOUND = java.net.HttpURLConnection.HTTP_NOT_FOUND;