Merge branch 'stable-5.9' into master
* stable-5.9: Prepare 5.9.1-SNAPSHOT builds JGit v5.9.0.202009080501-r [releng] Enable japicmp for the fragments added in 5.8.0 GitlinkMergeTest: fix boxing warnings Remove unused API problem filters Add missing since tag on BundleWriter#addObjectsAsIs GPG: include signer's user ID in the signature Change-Id: Iaa96f9228752540f446fc232a49f31a738fd8d30 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
commit
8cd49885ba
|
@ -128,7 +128,6 @@
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<!-- No previous version to compare to
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>com.github.siom79.japicmp</groupId>
|
<groupId>com.github.siom79.japicmp</groupId>
|
||||||
<artifactId>japicmp-maven-plugin</artifactId>
|
<artifactId>japicmp-maven-plugin</artifactId>
|
||||||
|
@ -170,13 +169,11 @@
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
-->
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<reporting>
|
<reporting>
|
||||||
<plugins>
|
<plugins>
|
||||||
<!-- No previous version to compare to
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>com.github.siom79.japicmp</groupId>
|
<groupId>com.github.siom79.japicmp</groupId>
|
||||||
<artifactId>japicmp-maven-plugin</artifactId>
|
<artifactId>japicmp-maven-plugin</artifactId>
|
||||||
|
@ -217,7 +214,6 @@
|
||||||
<skip>false</skip>
|
<skip>false</skip>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
-->
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</reporting>
|
</reporting>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.security.NoSuchProviderException;
|
import java.security.NoSuchProviderException;
|
||||||
import java.security.Security;
|
import java.security.Security;
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
import org.bouncycastle.bcpg.ArmoredOutputStream;
|
import org.bouncycastle.bcpg.ArmoredOutputStream;
|
||||||
import org.bouncycastle.bcpg.BCPGOutputStream;
|
import org.bouncycastle.bcpg.BCPGOutputStream;
|
||||||
|
@ -22,6 +23,7 @@
|
||||||
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||||
import org.bouncycastle.openpgp.PGPException;
|
import org.bouncycastle.openpgp.PGPException;
|
||||||
import org.bouncycastle.openpgp.PGPPrivateKey;
|
import org.bouncycastle.openpgp.PGPPrivateKey;
|
||||||
|
import org.bouncycastle.openpgp.PGPPublicKey;
|
||||||
import org.bouncycastle.openpgp.PGPSecretKey;
|
import org.bouncycastle.openpgp.PGPSecretKey;
|
||||||
import org.bouncycastle.openpgp.PGPSignature;
|
import org.bouncycastle.openpgp.PGPSignature;
|
||||||
import org.bouncycastle.openpgp.PGPSignatureGenerator;
|
import org.bouncycastle.openpgp.PGPSignatureGenerator;
|
||||||
|
@ -38,6 +40,7 @@
|
||||||
import org.eclipse.jgit.lib.GpgSigner;
|
import org.eclipse.jgit.lib.GpgSigner;
|
||||||
import org.eclipse.jgit.lib.PersonIdent;
|
import org.eclipse.jgit.lib.PersonIdent;
|
||||||
import org.eclipse.jgit.transport.CredentialsProvider;
|
import org.eclipse.jgit.transport.CredentialsProvider;
|
||||||
|
import org.eclipse.jgit.util.StringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GPG Signer using BouncyCastle library
|
* GPG Signer using BouncyCastle library
|
||||||
|
@ -126,17 +129,32 @@ public void sign(@NonNull CommitBuilder commit,
|
||||||
privateKey = secretKey
|
privateKey = secretKey
|
||||||
.extractPrivateKey(decryptorBuilder.build(passphrase));
|
.extractPrivateKey(decryptorBuilder.build(passphrase));
|
||||||
}
|
}
|
||||||
|
PGPPublicKey publicKey = secretKey.getPublicKey();
|
||||||
PGPSignatureGenerator signatureGenerator = new PGPSignatureGenerator(
|
PGPSignatureGenerator signatureGenerator = new PGPSignatureGenerator(
|
||||||
new JcaPGPContentSignerBuilder(
|
new JcaPGPContentSignerBuilder(
|
||||||
secretKey.getPublicKey().getAlgorithm(),
|
publicKey.getAlgorithm(),
|
||||||
HashAlgorithmTags.SHA256).setProvider(
|
HashAlgorithmTags.SHA256).setProvider(
|
||||||
BouncyCastleProvider.PROVIDER_NAME));
|
BouncyCastleProvider.PROVIDER_NAME));
|
||||||
signatureGenerator.init(PGPSignature.BINARY_DOCUMENT, privateKey);
|
signatureGenerator.init(PGPSignature.BINARY_DOCUMENT, privateKey);
|
||||||
PGPSignatureSubpacketGenerator subpacketGenerator = new PGPSignatureSubpacketGenerator();
|
PGPSignatureSubpacketGenerator subpackets = new PGPSignatureSubpacketGenerator();
|
||||||
subpacketGenerator.setIssuerFingerprint(false,
|
subpackets.setIssuerFingerprint(false, publicKey);
|
||||||
secretKey.getPublicKey());
|
// Also add the signer's user ID. Note that GPG uses only the e-mail
|
||||||
|
// address part.
|
||||||
|
String userId = committer.getEmailAddress();
|
||||||
|
Iterator<String> userIds = publicKey.getUserIDs();
|
||||||
|
if (userIds.hasNext()) {
|
||||||
|
String keyUserId = userIds.next();
|
||||||
|
if (!StringUtils.isEmptyOrNull(keyUserId)
|
||||||
|
&& (userId == null || !keyUserId.contains(userId))) {
|
||||||
|
// Not the committer's key?
|
||||||
|
userId = extractSignerId(keyUserId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (userId != null) {
|
||||||
|
subpackets.setSignerUserID(false, userId);
|
||||||
|
}
|
||||||
signatureGenerator
|
signatureGenerator
|
||||||
.setHashedSubpackets(subpacketGenerator.generate());
|
.setHashedSubpackets(subpackets.generate());
|
||||||
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
|
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
|
||||||
try (BCPGOutputStream out = new BCPGOutputStream(
|
try (BCPGOutputStream out = new BCPGOutputStream(
|
||||||
new ArmoredOutputStream(buffer))) {
|
new ArmoredOutputStream(buffer))) {
|
||||||
|
@ -149,4 +167,15 @@ public void sign(@NonNull CommitBuilder commit,
|
||||||
throw new JGitInternalException(e.getMessage(), e);
|
throw new JGitInternalException(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String extractSignerId(String pgpUserId) {
|
||||||
|
int from = pgpUserId.indexOf('<');
|
||||||
|
if (from >= 0) {
|
||||||
|
int to = pgpUserId.indexOf('>', from + 1);
|
||||||
|
if (to > from + 1) {
|
||||||
|
return pgpUserId.substring(from + 1, to);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return pgpUserId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,7 +123,6 @@
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<!-- No previous version to compare to
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>com.github.siom79.japicmp</groupId>
|
<groupId>com.github.siom79.japicmp</groupId>
|
||||||
<artifactId>japicmp-maven-plugin</artifactId>
|
<artifactId>japicmp-maven-plugin</artifactId>
|
||||||
|
@ -165,13 +164,11 @@
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
-->
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<reporting>
|
<reporting>
|
||||||
<plugins>
|
<plugins>
|
||||||
<!-- No previous version to compare to
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>com.github.siom79.japicmp</groupId>
|
<groupId>com.github.siom79.japicmp</groupId>
|
||||||
<artifactId>japicmp-maven-plugin</artifactId>
|
<artifactId>japicmp-maven-plugin</artifactId>
|
||||||
|
@ -212,7 +209,6 @@
|
||||||
<skip>false</skip>
|
<skip>false</skip>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
-->
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</reporting>
|
</reporting>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -151,7 +151,7 @@ protected Merger testGitLink(@Nullable String baseLink,
|
||||||
ObjectId t = commit(ow, treeT, new ObjectId[] { b });
|
ObjectId t = commit(ow, treeT, new ObjectId[] { b });
|
||||||
|
|
||||||
boolean merge = merger.merge(new ObjectId[] { o, t });
|
boolean merge = merger.merge(new ObjectId[] { o, t });
|
||||||
assertEquals(shouldMerge, merge);
|
assertEquals(Boolean.valueOf(shouldMerge), Boolean.valueOf(merge));
|
||||||
|
|
||||||
return merger;
|
return merger;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,73 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<component id="org.eclipse.jgit" version="2">
|
|
||||||
<resource path="META-INF/MANIFEST.MF" type="org.eclipse.jgit.transport.CredentialsProviderUserInfo">
|
|
||||||
<filter id="305324134">
|
|
||||||
<message_arguments>
|
|
||||||
<message_argument value="org.eclipse.jgit.transport.CredentialsProviderUserInfo"/>
|
|
||||||
<message_argument value="org.eclipse.jgit_5.8.0"/>
|
|
||||||
</message_arguments>
|
|
||||||
</filter>
|
|
||||||
</resource>
|
|
||||||
<resource path="META-INF/MANIFEST.MF" type="org.eclipse.jgit.transport.DefaultSshSessionFactory">
|
|
||||||
<filter id="305324134">
|
|
||||||
<message_arguments>
|
|
||||||
<message_argument value="org.eclipse.jgit.transport.DefaultSshSessionFactory"/>
|
|
||||||
<message_argument value="org.eclipse.jgit_5.8.0"/>
|
|
||||||
</message_arguments>
|
|
||||||
</filter>
|
|
||||||
</resource>
|
|
||||||
<resource path="META-INF/MANIFEST.MF" type="org.eclipse.jgit.transport.JschConfigSessionFactory">
|
|
||||||
<filter id="305324134">
|
|
||||||
<message_arguments>
|
|
||||||
<message_argument value="org.eclipse.jgit.transport.JschConfigSessionFactory"/>
|
|
||||||
<message_argument value="org.eclipse.jgit_5.8.0"/>
|
|
||||||
</message_arguments>
|
|
||||||
</filter>
|
|
||||||
</resource>
|
|
||||||
<resource path="META-INF/MANIFEST.MF" type="org.eclipse.jgit.transport.JschSession">
|
|
||||||
<filter id="305324134">
|
|
||||||
<message_arguments>
|
|
||||||
<message_argument value="org.eclipse.jgit.transport.JschSession"/>
|
|
||||||
<message_argument value="org.eclipse.jgit_5.8.0"/>
|
|
||||||
</message_arguments>
|
|
||||||
</filter>
|
|
||||||
</resource>
|
|
||||||
<resource path="META-INF/MANIFEST.MF" type="org.eclipse.jgit.transport.OpenSshConfig">
|
|
||||||
<filter id="305324134">
|
|
||||||
<message_arguments>
|
|
||||||
<message_argument value="org.eclipse.jgit.transport.OpenSshConfig"/>
|
|
||||||
<message_argument value="org.eclipse.jgit_5.8.0"/>
|
|
||||||
</message_arguments>
|
|
||||||
</filter>
|
|
||||||
</resource>
|
|
||||||
<resource path="src/org/eclipse/jgit/lib/BitmapIndex.java" type="org.eclipse.jgit.lib.BitmapIndex$Bitmap">
|
|
||||||
<filter id="403804204">
|
|
||||||
<message_arguments>
|
|
||||||
<message_argument value="org.eclipse.jgit.lib.BitmapIndex.Bitmap"/>
|
|
||||||
<message_argument value="retrieveCompressed()"/>
|
|
||||||
</message_arguments>
|
|
||||||
</filter>
|
|
||||||
</resource>
|
|
||||||
<resource path="src/org/eclipse/jgit/transport/SshSessionFactory.java" type="org.eclipse.jgit.transport.SshSessionFactory">
|
|
||||||
<filter id="336695337">
|
|
||||||
<message_arguments>
|
|
||||||
<message_argument value="org.eclipse.jgit.transport.SshSessionFactory"/>
|
|
||||||
<message_argument value="getType()"/>
|
|
||||||
</message_arguments>
|
|
||||||
</filter>
|
|
||||||
</resource>
|
|
||||||
<resource path="src/org/eclipse/jgit/transport/http/HttpConnection.java" type="org.eclipse.jgit.transport.http.HttpConnection">
|
|
||||||
<filter id="403767336">
|
|
||||||
<message_arguments>
|
|
||||||
<message_argument value="org.eclipse.jgit.transport.http.HttpConnection"/>
|
|
||||||
<message_argument value="HTTP_11_MOVED_PERM"/>
|
|
||||||
</message_arguments>
|
|
||||||
</filter>
|
|
||||||
<filter id="403767336">
|
|
||||||
<message_arguments>
|
|
||||||
<message_argument value="org.eclipse.jgit.transport.http.HttpConnection"/>
|
|
||||||
<message_argument value="HTTP_NOT_AUTHORITATIVE"/>
|
|
||||||
</message_arguments>
|
|
||||||
</filter>
|
|
||||||
</resource>
|
|
||||||
</component>
|
|
|
@ -169,6 +169,7 @@ else if (r.getObjectId() != null
|
||||||
*
|
*
|
||||||
* @param c
|
* @param c
|
||||||
* pack to include
|
* pack to include
|
||||||
|
* @since 5.9
|
||||||
*/
|
*/
|
||||||
public void addObjectsAsIs(Collection<? extends CachedPack> c) {
|
public void addObjectsAsIs(Collection<? extends CachedPack> c) {
|
||||||
cachedPacks.addAll(c);
|
cachedPacks.addAll(c);
|
||||||
|
|
Loading…
Reference in New Issue