From 81199f02fb49f79ef17b2daa3efac00d16040766 Mon Sep 17 00:00:00 2001 From: granny Date: Tue, 2 Jul 2024 15:15:37 -0700 Subject: [PATCH] Lib: Fix ssh value for gpg.format throwing an IllegalArgumentException 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 --- .../tst/org/eclipse/jgit/lib/GpgConfigTest.java | 10 ++++++++++ .../src/org/eclipse/jgit/lib/GpgConfig.java | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/GpgConfigTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/GpgConfigTest.java index 32f6766d47..5c2b190777 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/GpgConfigTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/GpgConfigTest.java @@ -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("" // diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/GpgConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/GpgConfig.java index 427a235f3b..4b0c07983f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/GpgConfig.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/GpgConfig.java @@ -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; -- 2.39.5