[ 
https://issues.apache.org/jira/browse/SCM-486?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16577327#comment-16577327
 ] 

ASF GitHub Bot commented on SCM-486:
------------------------------------

asfgit closed pull request #81: SCM-486
URL: https://github.com/apache/maven-scm/pull/81
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/maven-scm-api/src/main/java/org/apache/maven/scm/ScmTagParameters.java 
b/maven-scm-api/src/main/java/org/apache/maven/scm/ScmTagParameters.java
index 2db3d182c..12cea80b2 100644
--- a/maven-scm-api/src/main/java/org/apache/maven/scm/ScmTagParameters.java
+++ b/maven-scm-api/src/main/java/org/apache/maven/scm/ScmTagParameters.java
@@ -36,12 +36,15 @@
 
     private boolean pinExternals = false;
 
+    private boolean sign = false;
+
     private String scmRevision;
 
     public ScmTagParameters()
     {
         this.remoteTagging = false;
         this.pinExternals = false;
+        this.sign = false;
     }
 
     public ScmTagParameters( String message )
@@ -79,6 +82,16 @@ public void setPinExternals( boolean pinExternals )
         this.pinExternals = pinExternals;
     }
 
+    public boolean isSign()
+    {
+        return sign;
+    }
+
+    public void setSign( boolean sign )
+    {
+        this.sign = sign;
+    }
+
     public String getScmRevision()
     {
         return scmRevision;
diff --git 
a/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/TagMojo.java 
b/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/TagMojo.java
index a040d68fa..0b21fb385 100644
--- a/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/TagMojo.java
+++ b/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/TagMojo.java
@@ -98,6 +98,14 @@
     @Parameter( property = "pinExternals", defaultValue = "false" )
     private boolean pinExternals;
 
+    /**
+     * Enable the "--sign" in git
+     *
+     * @since 1.10.1
+     */
+    @Parameter( property = "sign", defaultValue = "false" )
+    private boolean sign;
+
     /** {@inheritDoc} */
     public void execute()
         throws MojoExecutionException
@@ -145,6 +153,7 @@ public void execute()
             ScmTagParameters scmTagParameters = new ScmTagParameters( message 
);
             scmTagParameters.setRemoteTagging( remoteTagging );
             scmTagParameters.setPinExternals( pinExternals );
+            scmTagParameters.setSign( sign );
 
             TagScmResult result = provider.tag( repository, getFileSet(), 
finalTag, scmTagParameters );
 
diff --git 
a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/tag/GitTagCommand.java
 
b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/tag/GitTagCommand.java
index f5b12eb40..ac7f0f4d7 100644
--- 
a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/tag/GitTagCommand.java
+++ 
b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/tag/GitTagCommand.java
@@ -92,7 +92,9 @@ public ScmResult executeTagCommand( ScmProviderRepository 
repo, ScmFileSet fileS
 
             int exitCode;
 
-            Commandline clTag = createCommandLine( repository, 
fileSet.getBasedir(), tag, messageFile );
+            boolean sign = scmTagParameters.isSign();
+
+            Commandline clTag = createCommandLine( repository, 
fileSet.getBasedir(), tag, messageFile, sign );
 
             exitCode = GitCommandLineUtils.execute( clTag, stdout, stderr, 
getLogger() );
             if ( exitCode != 0 )
@@ -147,10 +149,14 @@ public ScmResult executeTagCommand( ScmProviderRepository 
repo, ScmFileSet fileS
     // ----------------------------------------------------------------------
 
     public static Commandline createCommandLine( GitScmProviderRepository 
repository, File workingDirectory,
-                                                 String tag, File messageFile )
+                                                 String tag, File messageFile, 
boolean sign )
     {
         Commandline cl = GitCommandLineUtils.getBaseGitCommandLine( 
workingDirectory, "tag" );
 
+        if ( sign ) {
+            cl.createArg().setValue( "-s" );
+        }
+
         cl.createArg().setValue( "-F" );
         cl.createArg().setValue( messageFile.getAbsolutePath() );
 
diff --git 
a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/tag/GitTagCommandTest.java
 
b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/tag/GitTagCommandTest.java
index 68c475043..49c49439e 100644
--- 
a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/tag/GitTagCommandTest.java
+++ 
b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/tag/GitTagCommandTest.java
@@ -55,21 +55,28 @@ public void setUp()
     public void testCommandLineTag()
         throws Exception
     {
-        testCommandLine( "scm:git:http://foo.com/git/trunk";, "my-tag-1", "git 
tag " + messageFileString + " my-tag-1" );
+        testCommandLine( "scm:git:http://foo.com/git/trunk";, "my-tag-1", "git 
tag " + messageFileString + " my-tag-1", false );
     }
 
     public void testCommandLineWithUsernameAndTag()
         throws Exception
     {
         testCommandLine( "scm:git:http://anonym...@foo.com/git/trunk";, 
"my-tag-1",
-                         "git tag " + messageFileString + " my-tag-1" );
+                         "git tag " + messageFileString + " my-tag-1", false );
     }
 
+    public void testCommandLineWithUsernameAndTagAndSign()
+            throws Exception
+    {
+         testCommandLine( "scm:git:http://anonym...@foo.com/git/trunk";, 
"my-tag-1",
+                             "git tag -s " + messageFileString + " my-tag-1", 
true );
+    }
+    
     // ----------------------------------------------------------------------
     //
     // ----------------------------------------------------------------------
 
-    private void testCommandLine( String scmUrl, String tag, String 
commandLine )
+    private void testCommandLine( String scmUrl, String tag, String 
commandLine, boolean sign )
         throws Exception
     {
         File workingDirectory = getTestFile( "target/git-checkin-command-test" 
);
@@ -78,7 +85,7 @@ private void testCommandLine( String scmUrl, String tag, 
String commandLine )
 
         GitScmProviderRepository gitRepository = (GitScmProviderRepository) 
repository.getProviderRepository();
 
-        Commandline cl = GitTagCommand.createCommandLine( gitRepository, 
workingDirectory, tag, messageFile );
+        Commandline cl = GitTagCommand.createCommandLine( gitRepository, 
workingDirectory, tag, messageFile, sign );
 
         assertCommandLine( commandLine, workingDirectory, cl );
     }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Support signed tags for Git
> ---------------------------
>
>                 Key: SCM-486
>                 URL: https://issues.apache.org/jira/browse/SCM-486
>             Project: Maven SCM
>          Issue Type: New Feature
>          Components: maven-scm-provider-gitexe
>            Reporter: Chris Searle
>            Assignee: Michael Osipov
>            Priority: Major
>             Fix For: 1.10.1
>
>         Attachments: SCM-486_sign_git_tags.diff
>
>
> When tagging the release - it would be nice if the git plugin for scm allowed 
> for an annotated and signed tag rather than just an annotated tag.
> If this is already possible then either I need a pointer to the correct doc 
> ;) (or it would be nice if the doc covered how to configure it).



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to