diff options
-rw-r--r-- | .bazelrc | 2 | ||||
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java | 2 | ||||
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoProject.java | 7 | ||||
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackFile.java | 43 | ||||
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java | 7 | ||||
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevTag.java | 3 | ||||
-rw-r--r-- | pom.xml | 10 | ||||
-rw-r--r-- | tools/workspace_status.py | 2 |
8 files changed, 48 insertions, 28 deletions
@@ -2,7 +2,7 @@ # https://issues.gerritcodereview.com/issues/303819949 common --noenable_bzlmod -build --workspace_status_command="python ./tools/workspace_status.py" +build --workspace_status_command="python3 ./tools/workspace_status.py" build --repository_cache=~/.gerritcodereview/bazel-cache/repository build --incompatible_strict_action_env build --action_env=PATH diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java index 3aaef387f9..9979664ceb 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java @@ -255,7 +255,7 @@ public class RepoCommand extends GitCommand<RevCommit> { @SuppressWarnings("serial") static class ManifestErrorException extends GitAPIException { ManifestErrorException(Throwable cause) { - super(RepoText.get().invalidManifest, cause); + super(RepoText.get().invalidManifest + " " + cause.getMessage(), cause); } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoProject.java b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoProject.java index aa1af21d23..b96faab452 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoProject.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoProject.java @@ -395,7 +395,7 @@ public class RepoProject implements Comparable<RepoProject> { * * @return the upstream value if present, null otherwise. * - * @since 6.10 + * @since 7.0 */ public String getUpstream() { return this.upstream; @@ -407,9 +407,10 @@ public class RepoProject implements Comparable<RepoProject> { * Name of the git ref in which a sha1 can be found, when the revision is a * sha1. * - * @param upstream value of the attribute in the manifest + * @param upstream + * value of the attribute in the manifest * - * @since 6.10 + * @since 7.0 */ void setUpstream(String upstream) { this.upstream = upstream; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackFile.java index 5cc2a57aba..3e4d4d300c 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackFile.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackFile.java @@ -29,6 +29,7 @@ import java.nio.channels.Channels; import java.text.MessageFormat; import java.util.Set; import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicReference; import java.util.zip.CRC32; import java.util.zip.DataFormatException; import java.util.zip.Inflater; @@ -196,18 +197,24 @@ public final class DfsPackFile extends BlockBasedFile { .dispatch(new BeforeDfsPackIndexLoadedEvent(this)); try { DfsStreamKey idxKey = desc.getStreamKey(INDEX); - AtomicBoolean cacheHit = new AtomicBoolean(true); - DfsBlockCache.Ref<PackIndex> idxref = cache.getOrLoadRef(idxKey, + // Keep the value parsed in the loader, in case the Ref<> is + // nullified in ClockBlockCacheTable#reserveSpace + // before we read its value. + AtomicReference<PackIndex> loadedRef = new AtomicReference<>(null); + DfsBlockCache.Ref<PackIndex> cachedRef = cache.getOrLoadRef(idxKey, REF_POSITION, () -> { - cacheHit.set(false); - return loadPackIndex(ctx, idxKey); + RefWithSize<PackIndex> idx = loadPackIndex(ctx); + loadedRef.set(idx.ref); + return new DfsBlockCache.Ref<>(idxKey, REF_POSITION, + idx.size, idx.ref); }); - if (cacheHit.get()) { + if (loadedRef.get() == null) { ctx.stats.idxCacheHit++; } - PackIndex idx = idxref.get(); - if (index == null && idx != null) { - index = idx; + index = cachedRef.get() != null ? cachedRef.get() : loadedRef.get(); + if (index == null) { + throw new IOException( + "Couldn't get a reference to the primary index"); //$NON-NLS-1$ } ctx.emitIndexLoad(desc, INDEX, index); return index; @@ -1210,20 +1217,15 @@ public final class DfsPackFile extends BlockBasedFile { } } - private DfsBlockCache.Ref<PackIndex> loadPackIndex( - DfsReader ctx, DfsStreamKey idxKey) throws IOException { + private RefWithSize<PackIndex> loadPackIndex(DfsReader ctx) + throws IOException { try { ctx.stats.readIdx++; long start = System.nanoTime(); try (ReadableChannel rc = ctx.db.openFile(desc, INDEX)) { PackIndex idx = PackIndex.read(alignTo8kBlocks(rc)); ctx.stats.readIdxBytes += rc.position(); - index = idx; - return new DfsBlockCache.Ref<>( - idxKey, - REF_POSITION, - idx.getObjectCount() * REC_SIZE, - idx); + return new RefWithSize<>(idx, idx.getObjectCount() * REC_SIZE); } finally { ctx.stats.readIdxMicros += elapsedMicros(start); } @@ -1449,4 +1451,13 @@ public final class DfsPackFile extends BlockBasedFile { } } } + + private static final class RefWithSize<V> { + final V ref; + final long size; + RefWithSize(V ref, long size) { + this.ref = ref; + this.size = size; + } + } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java index 60a23dde05..1835dc76a2 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java @@ -494,6 +494,13 @@ public final class Constants { public static final String ATTR_BUILTIN_BINARY_MERGER = "binary"; //$NON-NLS-1$ /** + * Prefix of a GPG signature. + * + * @since 7.0 + */ + public static final String GPG_SIGNATURE_PREFIX = "-----BEGIN PGP SIGNATURE-----"; //$NON-NLS-1$ + + /** * Create a new digest function for objects. * * @return a new digest object. diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevTag.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevTag.java index 75dbd57740..5b50c2afd7 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevTag.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevTag.java @@ -13,6 +13,7 @@ package org.eclipse.jgit.revwalk; import static java.nio.charset.StandardCharsets.UTF_8; +import static org.eclipse.jgit.lib.Constants.GPG_SIGNATURE_PREFIX; import java.io.IOException; import java.nio.charset.Charset; @@ -39,7 +40,7 @@ import org.eclipse.jgit.util.StringUtils; public class RevTag extends RevObject { private static final byte[] hSignature = Constants - .encodeASCII("-----BEGIN PGP SIGNATURE-----"); //$NON-NLS-1$ + .encodeASCII(GPG_SIGNATURE_PREFIX); /** * Parse an annotated tag from its canonical format. @@ -33,8 +33,8 @@ </description> <scm> - <url>https://git.eclipse.org/r/plugins/gitiles/jgit/jgit</url> - <connection>scm:git:https://git.eclipse.org/r/jgit/jgit</connection> + <url>https://eclipse.gerrithub.io/plugins/gitiles/eclipse-jgit/jgit</url> + <connection>scm:git:https://eclipse.gerrithub.io/eclipse-jgit/jgit</connection> </scm> <ciManagement> @@ -95,8 +95,8 @@ </mailingLists> <issueManagement> - <url>https://bugs.eclipse.org/bugs/buglist.cgi?query_format=advanced;component=JGit;product=JGit;classification=Technology</url> - <system>Bugzilla</system> + <url>https://github.com/eclipse-jgit/jgit/issues</url> + <system>GitHub Issues</system> </issueManagement> <licenses> @@ -118,7 +118,7 @@ <project.build.outputTimestamp>${commit.time.iso}</project.build.outputTimestamp> - <jgit-last-release-version>6.9.0.202403050737-r</jgit-last-release-version> + <jgit-last-release-version>6.10.0.202406032230-r</jgit-last-release-version> <ant-version>1.10.14</ant-version> <apache-sshd-version>2.12.1</apache-sshd-version> <jsch-version>0.1.55</jsch-version> diff --git a/tools/workspace_status.py b/tools/workspace_status.py index ca9e0a98c9..1186a4a77a 100644 --- a/tools/workspace_status.py +++ b/tools/workspace_status.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright (C) 2020, David Ostrovsky <david@ostrovsky.org> and others # # This program and the accompanying materials are made available under the |