aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2024-08-27 15:13:37 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2024-08-27 15:13:37 +0200
commit887faeef6bc70726b9a1c0df9f2e9d34c6e14b88 (patch)
tree65ad3c1ecffe828bb4e3c6103afacdfeac4be780 /org.eclipse.jgit.test
parent1c2d79e9fff176e696b7fbb652bfcfb8e6b39618 (diff)
parent6e15524470d9b822a10644cee47e8475eea9f049 (diff)
downloadjgit-887faeef6bc70726b9a1c0df9f2e9d34c6e14b88.tar.gz
jgit-887faeef6bc70726b9a1c0df9f2e9d34c6e14b88.zip
Merge branch 'master' into stable-7.0
* master: DfsReaderIoStats: getters to object size index micros/bytes Do not set headers if response is already committed AmazonS3: Ensure SAXParserFactory sets valid/expected input params Signing: refactor interfaces Add a missing license header LockFile: Retry lock creation if parent dirs were removed GpgConfig: Add missing @since DfsReaderIoStats: Order fields and methods consistently Change-Id: I81bf15379c25e3ba69dda222c6980648fff07ec5
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitCommandTest.java73
1 files changed, 57 insertions, 16 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitCommandTest.java
index 35de73e204..e74e234297 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitCommandTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitCommandTest.java
@@ -27,6 +27,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.eclipse.jgit.api.CherryPickResult.CherryPickStatus;
import org.eclipse.jgit.api.errors.CanceledException;
import org.eclipse.jgit.api.errors.EmptyCommitException;
+import org.eclipse.jgit.api.errors.UnsupportedSigningFormatException;
import org.eclipse.jgit.api.errors.WrongRepositoryStateException;
import org.eclipse.jgit.diff.DiffEntry;
import org.eclipse.jgit.dircache.DirCache;
@@ -34,19 +35,23 @@ import org.eclipse.jgit.dircache.DirCacheBuilder;
import org.eclipse.jgit.dircache.DirCacheEntry;
import org.eclipse.jgit.junit.RepositoryTestCase;
import org.eclipse.jgit.junit.time.TimeUtil;
-import org.eclipse.jgit.lib.CommitBuilder;
+import org.eclipse.jgit.lib.CommitConfig.CleanupMode;
import org.eclipse.jgit.lib.ConfigConstants;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.FileMode;
-import org.eclipse.jgit.lib.GpgSigner;
+import org.eclipse.jgit.lib.GpgConfig;
+import org.eclipse.jgit.lib.GpgConfig.GpgFormat;
+import org.eclipse.jgit.lib.GpgSignature;
+import org.eclipse.jgit.lib.ObjectBuilder;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.PersonIdent;
import org.eclipse.jgit.lib.RefUpdate;
import org.eclipse.jgit.lib.RefUpdate.Result;
import org.eclipse.jgit.lib.ReflogEntry;
import org.eclipse.jgit.lib.Repository;
+import org.eclipse.jgit.lib.Signer;
+import org.eclipse.jgit.lib.Signers;
import org.eclipse.jgit.lib.StoredConfig;
-import org.eclipse.jgit.lib.CommitConfig.CleanupMode;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.storage.file.FileBasedConfig;
import org.eclipse.jgit.submodule.SubmoduleWalk;
@@ -839,21 +844,39 @@ public class CommitCommandTest extends RepositoryTestCase {
String[] signingKey = new String[1];
PersonIdent[] signingCommitters = new PersonIdent[1];
AtomicInteger callCount = new AtomicInteger();
- GpgSigner.setDefault(new GpgSigner() {
+ // Since GpgFormat defaults to OpenPGP just set a new signer for
+ // that.
+ Signers.set(GpgFormat.OPENPGP, new Signer() {
+
@Override
- public void sign(CommitBuilder commit, String gpgSigningKey,
- PersonIdent signingCommitter, CredentialsProvider credentialsProvider) {
- signingKey[0] = gpgSigningKey;
+ public void signObject(Repository repo, GpgConfig config,
+ ObjectBuilder builder, PersonIdent signingCommitter,
+ String signingKeySpec,
+ CredentialsProvider credentialsProvider)
+ throws CanceledException,
+ UnsupportedSigningFormatException {
+ signingKey[0] = signingKeySpec;
signingCommitters[0] = signingCommitter;
callCount.incrementAndGet();
}
@Override
- public boolean canLocateSigningKey(String gpgSigningKey,
- PersonIdent signingCommitter,
+ public GpgSignature sign(Repository repo, GpgConfig config,
+ byte[] data, PersonIdent signingCommitter,
+ String signingKeySpec,
+ CredentialsProvider credentialsProvider)
+ throws CanceledException,
+ UnsupportedSigningFormatException {
+ throw new CanceledException("Unexpected call");
+ }
+
+ @Override
+ public boolean canLocateSigningKey(Repository repo,
+ GpgConfig config, PersonIdent signingCommitter,
+ String signingKeySpec,
CredentialsProvider credentialsProvider)
throws CanceledException {
- return false;
+ throw new CanceledException("Unexpected call");
}
});
@@ -904,19 +927,37 @@ public class CommitCommandTest extends RepositoryTestCase {
git.add().addFilepattern("file1").call();
AtomicInteger callCount = new AtomicInteger();
- GpgSigner.setDefault(new GpgSigner() {
+ // Since GpgFormat defaults to OpenPGP just set a new signer for
+ // that.
+ Signers.set(GpgFormat.OPENPGP, new Signer() {
+
@Override
- public void sign(CommitBuilder commit, String gpgSigningKey,
- PersonIdent signingCommitter, CredentialsProvider credentialsProvider) {
+ public void signObject(Repository repo, GpgConfig config,
+ ObjectBuilder builder, PersonIdent signingCommitter,
+ String signingKeySpec,
+ CredentialsProvider credentialsProvider)
+ throws CanceledException,
+ UnsupportedSigningFormatException {
callCount.incrementAndGet();
}
@Override
- public boolean canLocateSigningKey(String gpgSigningKey,
- PersonIdent signingCommitter,
+ public GpgSignature sign(Repository repo, GpgConfig config,
+ byte[] data, PersonIdent signingCommitter,
+ String signingKeySpec,
+ CredentialsProvider credentialsProvider)
+ throws CanceledException,
+ UnsupportedSigningFormatException {
+ throw new CanceledException("Unexpected call");
+ }
+
+ @Override
+ public boolean canLocateSigningKey(Repository repo,
+ GpgConfig config, PersonIdent signingCommitter,
+ String signingKeySpec,
CredentialsProvider credentialsProvider)
throws CanceledException {
- return false;
+ throw new CanceledException("Unexpected call");
}
});