This is an automated email from the ASF dual-hosted git repository.

exceptionfactory pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/main by this push:
     new 49702f1f51 NIFI-12668 Fix conflict in Registry Git provider with 
gpg.format=ssh
49702f1f51 is described below

commit 49702f1f510cc33c9cb52bb5b9580009a1d8afe8
Author: Brian Ghigiarelli <briang...@gmail.com>
AuthorDate: Wed Jan 24 22:21:27 2024 -0500

    NIFI-12668 Fix conflict in Registry Git provider with gpg.format=ssh
    
    NIFI-12667 Upgraded JGit from 6.7.0 to 6.8.0
    
    This closes #8300
    
    Signed-off-by: David Handermann <exceptionfact...@apache.org>
---
 .../apache/nifi/registry/provider/flow/git/GitFlowMetaData.java  | 9 +++++++++
 nifi-registry/pom.xml                                            | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git 
a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/flow/git/GitFlowMetaData.java
 
b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/flow/git/GitFlowMetaData.java
index 5e99c392eb..5c7720921d 100644
--- 
a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/flow/git/GitFlowMetaData.java
+++ 
b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/flow/git/GitFlowMetaData.java
@@ -24,6 +24,8 @@ import org.eclipse.jgit.api.PushCommand;
 import org.eclipse.jgit.api.Status;
 import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.api.errors.NoHeadException;
+import org.eclipse.jgit.lib.Config;
+import org.eclipse.jgit.lib.GpgConfig;
 import org.eclipse.jgit.lib.ObjectId;
 import org.eclipse.jgit.lib.ObjectStream;
 import org.eclipse.jgit.lib.Ref;
@@ -475,9 +477,16 @@ class GitFlowMetaData {
 
             final String commitMessage = isEmpty(author) ? message
                     : format("%s\n\nBy NiFi Registry user: %s", message, 
author);
+
+            // Ensure that we are providing a valid GPG Format to jgit, even 
though
+            // it is not used for signing. This avoids an error if the system's
+            // git config for gpg.format is "ssh".
+            final Config unusedConfig = new Config();
+            unusedConfig.setEnum("gpg", null, "format", 
GpgConfig.GpgFormat.OPENPGP);
             final RevCommit commit = git.commit()
                     .setMessage(commitMessage)
                     .setSign(false)
+                    .setGpgConfig(new GpgConfig(unusedConfig))
                     .call();
 
             if (flowPointer != null) {
diff --git a/nifi-registry/pom.xml b/nifi-registry/pom.xml
index b4356cbd43..2fd110ea25 100644
--- a/nifi-registry/pom.xml
+++ b/nifi-registry/pom.xml
@@ -40,7 +40,7 @@
         <flyway.version>9.22.3</flyway.version>
         <flyway.tests.version>9.5.0</flyway.tests.version>
         <swagger.ui.version>3.12.0</swagger.ui.version>
-        <jgit.version>6.7.0.202309050840-r</jgit.version>
+        <jgit.version>6.8.0.202311291450-r</jgit.version>
         <org.apache.sshd.version>2.12.0</org.apache.sshd.version>
     </properties>
 

Reply via email to