]> source.dussan.org Git - jgit.git/commitdiff
Lib: Fix ssh value for gpg.format throwing an IllegalArgumentException 35/1197035/2
authorgranny <contact@granny.dev>
Tue, 2 Jul 2024 22:15:37 +0000 (15:15 -0700)
committergranny <contact@granny.dev>
Tue, 30 Jul 2024 23:53:34 +0000 (23:53 +0000)
Git version 2.34 and later supports signing commits and tags with SSH keys. This means gpg.format now supports "ssh" as a value.

Change-Id: Iee1e5a68a816bec149a17a73a6916d2884a54163

org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/GpgConfigTest.java
org.eclipse.jgit/src/org/eclipse/jgit/lib/GpgConfig.java

index 32f6766d47ce2eec7e073b5070ee0a73c70cf548..5c2b1907774d6f7d6b297041b312096d358ae351 100644 (file)
@@ -95,6 +95,16 @@ public class GpgConfigTest {
                assertEquals(GpgConfig.GpgFormat.X509, new GpgConfig(c).getKeyFormat());
        }
 
+       @Test
+       public void testGetKeyFormat_ssh() throws Exception {
+               Config c = parse("" //
+                               + "[gpg]\n" //
+                               + "  format = ssh\n" //
+               );
+
+               assertEquals(GpgConfig.GpgFormat.SSH, new GpgConfig(c).getKeyFormat());
+       }
+
        @Test
        public void testGetSigningKey() throws Exception {
                Config c = parse("" //
index 427a235f3b3cc8064945119a1e0a3484ad479197..4b0c07983f324c6c94327ab115c04373f8e2450a 100644 (file)
@@ -24,7 +24,9 @@ public class GpgConfig {
                /** Value for openpgp */
                OPENPGP("openpgp"), //$NON-NLS-1$
                /** Value for x509 */
-               X509("x509"); //$NON-NLS-1$
+               X509("x509"), //$NON-NLS-1$
+               /** Value for ssh */
+               SSH("ssh"); //$NON-NLS-1$
 
                private final String configValue;