diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2023-05-24 15:50:27 +0200 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2023-05-24 15:50:27 +0200 |
commit | f7ba6c2356bcf1b49b3146fd536f49241a7816bd (patch) | |
tree | d70427e952e65c24cd3670eaad590800bc5baf4e /org.eclipse.jgit | |
parent | 05e7e9d5a272c6def063dc62a803a5414df7d4bb (diff) | |
parent | 590f03b7dc203aadb5606f330a79065a2f81f850 (diff) | |
download | jgit-f7ba6c2356bcf1b49b3146fd536f49241a7816bd.tar.gz jgit-f7ba6c2356bcf1b49b3146fd536f49241a7816bd.zip |
Merge branch 'master' into stable-6.6
* master:
GraphObjectIndex: fix search in findGraphPosition
Update to Tycho 4.0.0-SNAPSHOT
PGP sign p2 artefacts
Revert 'Use net.i2p.crypto:eddsa directly from Maven Central'
Update dash license-tool-plugin to 1.0.2
Also add suppressed exception if unchecked exception occurs in finally
Candidate: use "Objects.equals" instead of "=="
Use hamcrest 2.2 directly from Maven Central
Use commons-logging directly from Maven Central
Update jna to 5.13.0
Use bytebuddy directly from Maven Central
Use jna directly from Maven Central
Use net.i2p.crypto:eddsa directly from Maven Central
Use org.tukaani:xz directly from Maven Central
Use args4j directly from Maven Central
Use gson directly from Maven Central
Remove unused $NON-NLS-1$
Remove unused API filters
Switch to Apache MINA sshd 2.10.0
[releng] API filter for PackIndex.DEFAULT_WRITE_REVERSE_INDEX
PackExt: add a #getTmpExtension method
UploadPack: Record negotiation stats on fetchV2 call
RewriteGeneratorTest: Introduce test cases for the RewriteGenerator
PackWriter: write the PackReverseIndex file
Change-Id: I6c7760a32545320862abcdcc8761c9b728e78182
Diffstat (limited to 'org.eclipse.jgit')
13 files changed, 120 insertions, 189 deletions
diff --git a/org.eclipse.jgit/.settings/.api_filters b/org.eclipse.jgit/.settings/.api_filters index 1fbc01102b..75697fd88a 100644 --- a/org.eclipse.jgit/.settings/.api_filters +++ b/org.eclipse.jgit/.settings/.api_filters @@ -14,161 +14,13 @@ </message_arguments> </filter> </resource> - <resource path="src/org/eclipse/jgit/lib/BatchingProgressMonitor.java" type="org.eclipse.jgit.lib.BatchingProgressMonitor"> - <filter id="336695337"> - <message_arguments> - <message_argument value="org.eclipse.jgit.lib.BatchingProgressMonitor"/> - <message_argument value="onEndTask(String, int, Duration)"/> - </message_arguments> - </filter> - <filter id="336695337"> - <message_arguments> - <message_argument value="org.eclipse.jgit.lib.BatchingProgressMonitor"/> - <message_argument value="onEndTask(String, int, int, int, Duration)"/> - </message_arguments> - </filter> - <filter id="336695337"> - <message_arguments> - <message_argument value="org.eclipse.jgit.lib.BatchingProgressMonitor"/> - <message_argument value="onUpdate(String, int, Duration)"/> - </message_arguments> - </filter> - <filter id="336695337"> - <message_arguments> - <message_argument value="org.eclipse.jgit.lib.BatchingProgressMonitor"/> - <message_argument value="onUpdate(String, int, int, int, Duration)"/> - </message_arguments> - </filter> - <filter id="338792546"> - <message_arguments> - <message_argument value="org.eclipse.jgit.lib.BatchingProgressMonitor"/> - <message_argument value="onEndTask(String, int)"/> - </message_arguments> - </filter> - <filter id="338792546"> - <message_arguments> - <message_argument value="org.eclipse.jgit.lib.BatchingProgressMonitor"/> - <message_argument value="onEndTask(String, int, int, int)"/> - </message_arguments> - </filter> - <filter id="338792546"> - <message_arguments> - <message_argument value="org.eclipse.jgit.lib.BatchingProgressMonitor"/> - <message_argument value="onUpdate(String, int)"/> - </message_arguments> - </filter> - <filter id="338792546"> - <message_arguments> - <message_argument value="org.eclipse.jgit.lib.BatchingProgressMonitor"/> - <message_argument value="onUpdate(String, int, int, int)"/> - </message_arguments> - </filter> - </resource> - <resource path="src/org/eclipse/jgit/lib/BranchConfig.java" type="org.eclipse.jgit.lib.BranchConfig$BranchRebaseMode"> - <filter id="372293724"> - <message_arguments> - <message_argument value="org.eclipse.jgit.lib.BranchConfig.BranchRebaseMode"/> - <message_argument value="PRESERVE"/> - </message_arguments> - </filter> - </resource> <resource path="src/org/eclipse/jgit/lib/ConfigConstants.java" type="org.eclipse.jgit.lib.ConfigConstants"> <filter id="1142947843"> <message_arguments> <message_argument value="5.13.2"/> - <message_argument value="CONFIG_KEY_BITMAP_EXCLUDED_REFS_PREFIXES"/> - </message_arguments> - </filter> - <filter id="1142947843"> - <message_arguments> - <message_argument value="5.13.2"/> - <message_argument value="CONFIG_KEY_PRESERVE_OLD_PACKS"/> - </message_arguments> - </filter> - <filter id="1142947843"> - <message_arguments> - <message_argument value="5.13.2"/> - <message_argument value="CONFIG_KEY_PRUNE_PRESERVED"/> - </message_arguments> - </filter> - <filter id="1142947843"> - <message_arguments> - <message_argument value="5.13.2"/> <message_argument value="CONFIG_KEY_SKIPHASH"/> </message_arguments> </filter> - <filter id="1142947843"> - <message_arguments> - <message_argument value="6.1.1"/> - <message_argument value="CONFIG_KEY_TRUST_PACKED_REFS_STAT"/> - </message_arguments> - </filter> - </resource> - <resource path="src/org/eclipse/jgit/lib/CoreConfig.java" type="org.eclipse.jgit.lib.CoreConfig"> - <filter id="336658481"> - <message_arguments> - <message_argument value="org.eclipse.jgit.lib.CoreConfig"/> - <message_argument value="DEFAULT_COMMIT_GRAPH_ENABLE"/> - </message_arguments> - </filter> - </resource> - <resource path="src/org/eclipse/jgit/lib/CoreConfig.java" type="org.eclipse.jgit.lib.CoreConfig$TrustPackedRefsStat"> - <filter id="1142947843"> - <message_arguments> - <message_argument value="6.1.1"/> - <message_argument value="TrustPackedRefsStat"/> - </message_arguments> - </filter> - </resource> - <resource path="src/org/eclipse/jgit/lib/ProgressMonitor.java" type="org.eclipse.jgit.lib.ProgressMonitor"> - <filter id="403804204"> - <message_arguments> - <message_argument value="org.eclipse.jgit.lib.ProgressMonitor"/> - <message_argument value="showDuration(boolean)"/> - </message_arguments> - </filter> - </resource> - <resource path="src/org/eclipse/jgit/lib/RefDatabase.java" type="org.eclipse.jgit.lib.RefDatabase"> - <filter id="336658481"> - <message_arguments> - <message_argument value="org.eclipse.jgit.lib.RefDatabase"/> - <message_argument value="additionalRefsNames"/> - </message_arguments> - </filter> - </resource> - <resource path="src/org/eclipse/jgit/lib/Repository.java" type="org.eclipse.jgit.lib.Repository"> - <filter id="1142947843"> - <message_arguments> - <message_argument value="5.13.2"/> - <message_argument value="getReflogReader(Ref)"/> - </message_arguments> - </filter> - </resource> - <resource path="src/org/eclipse/jgit/lib/TextProgressMonitor.java" type="org.eclipse.jgit.lib.TextProgressMonitor"> - <filter id="338792546"> - <message_arguments> - <message_argument value="org.eclipse.jgit.lib.TextProgressMonitor"/> - <message_argument value="onEndTask(String, int)"/> - </message_arguments> - </filter> - <filter id="338792546"> - <message_arguments> - <message_argument value="org.eclipse.jgit.lib.TextProgressMonitor"/> - <message_argument value="onEndTask(String, int, int, int)"/> - </message_arguments> - </filter> - <filter id="338792546"> - <message_arguments> - <message_argument value="org.eclipse.jgit.lib.TextProgressMonitor"/> - <message_argument value="onUpdate(String, int)"/> - </message_arguments> - </filter> - <filter id="338792546"> - <message_arguments> - <message_argument value="org.eclipse.jgit.lib.TextProgressMonitor"/> - <message_argument value="onUpdate(String, int, int, int)"/> - </message_arguments> - </filter> </resource> <resource path="src/org/eclipse/jgit/revwalk/RevCommit.java" type="org.eclipse.jgit.revwalk.RevCommit"> <filter id="1193279491"> @@ -182,31 +34,7 @@ <filter id="336658481"> <message_arguments> <message_argument value="org.eclipse.jgit.storage.pack.PackConfig"/> - <message_argument value="DEFAULT_BITMAP_EXCLUDED_REFS_PREFIXES"/> - </message_arguments> - </filter> - <filter id="336658481"> - <message_arguments> - <message_argument value="org.eclipse.jgit.storage.pack.PackConfig"/> - <message_argument value="DEFAULT_MIN_BYTES_FOR_OBJ_SIZE_INDEX"/> - </message_arguments> - </filter> - <filter id="1142947843"> - <message_arguments> - <message_argument value="5.13.2"/> - <message_argument value="DEFAULT_BITMAP_EXCLUDED_REFS_PREFIXES"/> - </message_arguments> - </filter> - <filter id="1142947843"> - <message_arguments> - <message_argument value="5.13.2"/> - <message_argument value="getBitmapExcludedRefsPrefixes()"/> - </message_arguments> - </filter> - <filter id="1142947843"> - <message_arguments> - <message_argument value="5.13.2"/> - <message_argument value="setBitmapExcludedRefsPrefixes(String[])"/> + <message_argument value="DEFAULT_WRITE_REVERSE_INDEX"/> </message_arguments> </filter> </resource> diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/blame/Candidate.java b/org.eclipse.jgit/src/org/eclipse/jgit/blame/Candidate.java index ca5370e912..ccf99ff5b5 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/blame/Candidate.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/blame/Candidate.java @@ -12,6 +12,7 @@ package org.eclipse.jgit.blame; import java.io.IOException; import java.util.List; +import java.util.Objects; import org.eclipse.jgit.blame.ReverseWalk.ReverseCommit; import org.eclipse.jgit.diff.Edit; @@ -269,7 +270,7 @@ class Candidate { } boolean canMergeRegions(Candidate other) { - return sourceCommit == other.sourceCommit + return Objects.equals(sourceCommit, other.sourceCommit) && sourcePath.getPath().equals(other.sourcePath.getPath()); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/commitgraph/GraphObjectIndex.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/commitgraph/GraphObjectIndex.java index b0df46732e..22b4011f9f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/commitgraph/GraphObjectIndex.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/commitgraph/GraphObjectIndex.java @@ -80,7 +80,7 @@ class GraphObjectIndex { if (levelOne > 0) { low = fanoutTable[levelOne - 1]; } - do { + while (low < high) { int mid = (low + high) >>> 1; int pos = objIdOffset(mid); int cmp = id.compareTo(oidLookup, pos); @@ -91,7 +91,7 @@ class GraphObjectIndex { } else { low = mid + 1; } - } while (low < high); + } return -1; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsGarbageCollector.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsGarbageCollector.java index 66bcf73987..92e23b8b40 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsGarbageCollector.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsGarbageCollector.java @@ -577,6 +577,7 @@ public class DfsGarbageCollector { cfg.setReuseObjects(true); cfg.setDeltaCompress(false); cfg.setBuildBitmaps(false); + cfg.setWriteReverseIndex(false); try (PackWriter pw = new PackWriter(cfg, ctx); RevWalk pool = new RevWalk(ctx)) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java index be359bbeaa..11757aabda 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java @@ -11,6 +11,7 @@ package org.eclipse.jgit.internal.storage.file; import static org.eclipse.jgit.internal.storage.pack.PackExt.BITMAP_INDEX; +import static org.eclipse.jgit.internal.storage.pack.PackExt.COMMIT_GRAPH; import static org.eclipse.jgit.internal.storage.pack.PackExt.INDEX; import static org.eclipse.jgit.internal.storage.pack.PackExt.KEEP; import static org.eclipse.jgit.internal.storage.pack.PackExt.PACK; @@ -943,7 +944,8 @@ public class GC { try (RevWalk walk = new RevWalk(repo)) { CommitGraphWriter writer = new CommitGraphWriter( GraphCommits.fromWalk(pm, wants, walk)); - tmpFile = File.createTempFile("commit_", ".graph_tmp", //$NON-NLS-1$//$NON-NLS-2$ + tmpFile = File.createTempFile("commit_", //$NON-NLS-1$ + COMMIT_GRAPH.getTmpExtension(), repo.getObjectDatabase().getInfoDirectory()); // write the commit-graph file try (FileOutputStream fos = new FileOutputStream(tmpFile); @@ -1292,10 +1294,11 @@ public class GC { ObjectId id = pw.computeName(); File packdir = repo.getObjectDatabase().getPackDirectory(); packdir.mkdirs(); - tmpPack = File.createTempFile("gc_", ".pack_tmp", packdir); //$NON-NLS-1$ //$NON-NLS-2$ - final String tmpBase = tmpPack.getName() + tmpPack = File.createTempFile("gc_", //$NON-NLS-1$ + PACK.getTmpExtension(), packdir); + String tmpBase = tmpPack.getName() .substring(0, tmpPack.getName().lastIndexOf('.')); - File tmpIdx = new File(packdir, tmpBase + ".idx_tmp"); //$NON-NLS-1$ + File tmpIdx = new File(packdir, tmpBase + INDEX.getTmpExtension()); tmpExts.put(INDEX, tmpIdx); if (!tmpIdx.createNewFile()) @@ -1321,7 +1324,8 @@ public class GC { } if (pw.prepareBitmapIndex(pm)) { - File tmpBitmapIdx = new File(packdir, tmpBase + ".bitmap_tmp"); //$NON-NLS-1$ + File tmpBitmapIdx = new File(packdir, + tmpBase + BITMAP_INDEX.getTmpExtension()); tmpExts.put(BITMAP_INDEX, tmpBitmapIdx); if (!tmpBitmapIdx.createNewFile()) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackExt.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackExt.java index adad411c6f..d580083795 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackExt.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackExt.java @@ -71,6 +71,15 @@ public enum PackExt { return 1 << getPosition(); } + /** + * Format a temporary file extension for this PackExt. + * + * @return a temporary file extension + */ + public String getTmpExtension() { + return String.format(".%s_tmp", ext); //$NON-NLS-1$ + } + /** {@inheritDoc} */ @Override public String toString() { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java index bad572459a..9508f3fe39 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java @@ -62,6 +62,7 @@ import org.eclipse.jgit.internal.storage.file.PackBitmapIndexBuilder; import org.eclipse.jgit.internal.storage.file.PackBitmapIndexWriterV1; import org.eclipse.jgit.internal.storage.file.PackIndexWriter; import org.eclipse.jgit.internal.storage.file.PackObjectSizeIndexWriter; +import org.eclipse.jgit.internal.storage.file.PackReverseIndexWriter; import org.eclipse.jgit.lib.AnyObjectId; import org.eclipse.jgit.lib.AsyncObjectSizeQueue; import org.eclipse.jgit.lib.BatchingProgressMonitor; @@ -1137,6 +1138,38 @@ public class PackWriter implements AutoCloseable { } /** + * Whether the writer will write a reverse index file. The configuration + * flag must be on and the writer must be able to write corresponding + * forward index. + * + * @return whether the writer will write a reverse index file + */ + public boolean isReverseIndexEnabled() { + // Only write the reverse index if the writer is configured to and the + // forward index that it would correspond to will be written. + return config.isWriteReverseIndex() && !isIndexDisabled(); + } + + /** + * Write the pack's reverse index file to the output stream. + * + * @param stream + * where to write the file contents to + * @throws IOException + * if writing to the stream fails + */ + public void writeReverseIndex(OutputStream stream) throws IOException { + if (!isReverseIndexEnabled()) { + return; + } + long writeStart = System.currentTimeMillis(); + PackReverseIndexWriter writer = PackReverseIndexWriter + .createWriter(stream); + writer.write(sortByName(), packcsum); + stats.timeWriting += System.currentTimeMillis() - writeStart; + } + + /** * Create a bitmap index file to match the pack file just written. * <p> * Called after {@link #prepareBitmapIndex(ProgressMonitor)}. @@ -1690,6 +1723,11 @@ public class PackWriter implements AutoCloseable { } throw new IOException(JGitText .get().packingCancelledDuringObjectsWriting, e); + } catch (Throwable e) { + if (e1 != null) { + e.addSuppressed(e1); + } + throw e; } } } 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 c4b6bf955e..4c080f4761 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java @@ -745,6 +745,13 @@ public final class ConfigConstants { public static final String CONFIG_KEY_BITMAP_RECENT_COMMIT_COUNT = "bitmaprecentcommitspan"; /** + * The "pack.writeReverseIndex" key + * + * @since 6.6 + */ + public static final String CONFIG_KEY_WRITE_REVERSE_INDEX = "writeReverseIndex"; + + /** * The "pack.buildBitmaps" key * @since 5.8 */ 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 a0c978f6ea..b0b1d4ff2d 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 @@ -27,7 +27,10 @@ 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_BYTES_OBJ_SIZE_INDEX; import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_MIN_SIZE_PREVENT_RACYPACK; +import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_PRESERVE_OLD_PACKS; +import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_PRUNE_PRESERVED; 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_SEARCH_FOR_REUSE_TIMEOUT; @@ -36,10 +39,8 @@ 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_KEY_MIN_BYTES_OBJ_SIZE_INDEX; +import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_WRITE_REVERSE_INDEX; import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_PACK_SECTION; -import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_PRESERVE_OLD_PACKS; -import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_PRUNE_PRESERVED; import java.time.Duration; import java.util.concurrent.Executor; @@ -162,6 +163,14 @@ public class PackConfig { public static final int DEFAULT_INDEX_VERSION = 2; /** + * Default value of the write reverse index option: {@value} + * + * @see #setWriteReverseIndex(boolean) + * @since 6.6 + */ + public static final boolean DEFAULT_WRITE_REVERSE_INDEX = false; + + /** * Default value of the build bitmaps option: {@value} * * @see #setBuildBitmaps(boolean) @@ -292,6 +301,8 @@ public class PackConfig { private int indexVersion = DEFAULT_INDEX_VERSION; + private boolean writeReverseIndex = DEFAULT_WRITE_REVERSE_INDEX; + private boolean buildBitmaps = DEFAULT_BUILD_BITMAPS; private int bitmapContiguousCommitCount = DEFAULT_BITMAP_CONTIGUOUS_COMMIT_COUNT; @@ -373,6 +384,7 @@ public class PackConfig { this.threads = cfg.threads; this.executor = cfg.executor; this.indexVersion = cfg.indexVersion; + this.writeReverseIndex = cfg.writeReverseIndex; this.buildBitmaps = cfg.buildBitmaps; this.bitmapContiguousCommitCount = cfg.bitmapContiguousCommitCount; this.bitmapRecentCommitCount = cfg.bitmapRecentCommitCount; @@ -974,6 +986,31 @@ public class PackConfig { } /** + * True if the writer should write reverse index files. + * + * Default setting: {@value #DEFAULT_WRITE_REVERSE_INDEX} + * + * @return whether the writer should write reverse index files + * @since 6.6 + */ + public boolean isWriteReverseIndex() { + return writeReverseIndex; + } + + /** + * Set whether the writer will write reverse index files. + * + * Default setting: {@value #DEFAULT_WRITE_REVERSE_INDEX} + * + * @param writeReverseIndex + * whether the writer should write reverse index files + * @since 6.6 + */ + public void setWriteReverseIndex(boolean writeReverseIndex) { + this.writeReverseIndex = writeReverseIndex; + } + + /** * True if writer is allowed to build bitmaps for indexes. * * Default setting: {@value #DEFAULT_BUILD_BITMAPS} @@ -1286,6 +1323,8 @@ public class PackConfig { setSinglePack(rc.getBoolean(CONFIG_PACK_SECTION, CONFIG_KEY_SINGLE_PACK, getSinglePack())); + setWriteReverseIndex(rc.getBoolean(CONFIG_PACK_SECTION, + CONFIG_KEY_WRITE_REVERSE_INDEX, isWriteReverseIndex())); setBuildBitmaps(rc.getBoolean(CONFIG_PACK_SECTION, CONFIG_KEY_BUILD_BITMAPS, isBuildBitmaps())); setBitmapContiguousCommitCount(rc.getInt(CONFIG_PACK_SECTION, @@ -1347,6 +1386,7 @@ public class PackConfig { b.append(", reuseDeltas=").append(isReuseDeltas()); //$NON-NLS-1$ b.append(", reuseObjects=").append(isReuseObjects()); //$NON-NLS-1$ b.append(", deltaCompress=").append(isDeltaCompress()); //$NON-NLS-1$ + b.append(", writeReverseIndex=").append(isWriteReverseIndex()); //$NON-NLS-1$ b.append(", buildBitmaps=").append(isBuildBitmaps()); //$NON-NLS-1$ b.append(", bitmapContiguousCommitCount=") //$NON-NLS-1$ .append(getBitmapContiguousCommitCount()); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java index d482521747..b873925316 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java @@ -596,7 +596,7 @@ public class AmazonS3 { final String key, final Map<String, String> args) throws IOException { final StringBuilder urlstr = new StringBuilder(); - urlstr.append(protocol); //$NON-NLS-1$ + urlstr.append(protocol); urlstr.append("://"); //$NON-NLS-1$ urlstr.append(bucket); urlstr.append('.'); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java index f02160e457..c510194ee6 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java @@ -111,7 +111,7 @@ class FetchProcess { for (PackLock lock : packLocks) { lock.unlock(); } - } catch (IOException e) { + } catch (Throwable e) { if (e1 != null) { e.addSuppressed(e1); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java index f245eae39f..3264f556fa 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java @@ -1189,6 +1189,7 @@ public class UploadPack implements Closeable { PackStatistics.Accumulator accumulator = new PackStatistics.Accumulator(); Instant negotiateStart = Instant.now(); + accumulator.advertised = advertised.size(); ProtocolV2Parser parser = new ProtocolV2Parser(transferConfig); FetchV2Request req = parser.parseFetchRequest(pckIn); @@ -1209,6 +1210,7 @@ public class UploadPack implements Closeable { // TODO(ifrade): Avoid mutating the parsed request. req.getWantIds().addAll(wantedRefs.values()); wantIds = req.getWantIds(); + accumulator.wants = wantIds.size(); boolean sectionSent = false; boolean mayHaveShallow = req.getDepth() != 0 @@ -1766,7 +1768,6 @@ public class UploadPack implements Closeable { && line.length() == PACKET_HAVE.length() + 40) { peerHas.add(ObjectId .fromString(line.substring(PACKET_HAVE.length()))); - accumulator.haves++; } else if (line.equals(PACKET_DONE)) { last = processHaveLines(peerHas, last, pckOut, accumulator, Option.NONE); @@ -1798,6 +1799,7 @@ public class UploadPack implements Closeable { parseWants(accumulator); if (peerHas.isEmpty()) return last; + accumulator.haves += peerHas.size(); sentReady = false; int haveCnt = 0; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java index ed8f450c53..cc6c252fa1 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java @@ -530,9 +530,10 @@ class WalkFetchConnection extends BaseFetchConnection { // are unusable and we shouldn't consult them again. // try { - if (pack.tmpIdx != null) + if (pack.tmpIdx != null) { FileUtils.delete(pack.tmpIdx); - } catch (IOException e) { + } + } catch (Throwable e) { if (e1 != null) { e.addSuppressed(e1); } |