maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (SCM-714) mvn release:prepare fails if the command line is too long on windows
Date Mon, 14 May 2018 17:10:00 GMT

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

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

McLuck closed pull request #41: SCM-714 fix git commit when command line got too long
URL: https://github.com/apache/maven-scm/pull/41
 
 
   

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-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/GitCommandLineUtils.java
b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/GitCommandLineUtils.java
index 2599273d9..9ffd69d0b 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/GitCommandLineUtils.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/GitCommandLineUtils.java
@@ -29,6 +29,7 @@
 import java.io.File;
 import java.io.IOException;
 import java.util.List;
+import java.util.Set;
 
 /**
  * Command line construction utility.
@@ -80,6 +81,29 @@ public static void addTarget( Commandline cl, List<File> files )
                 + workingDirectory + " or files=" + files, ex );
         }
     }
+    
+    /**
+     * 
+     * @param cl
+     * @param files
+     */
+    public static void addTargetPattern( Commandline cl, List<File> files ) 
+    {
+        if ( files == null || files.isEmpty() ) 
+        {
+            return;
+        }
+        Set<String> fileToAdd = new java.util.HashSet<String>();
+
+        for ( File file : files ) 
+        {
+            fileToAdd.add( file.getName() );
+        }
+        for ( String patternFile : fileToAdd ) 
+        {
+            cl.createArg().setValue( "*" + patternFile );
+        }
+    }
 
     /**
      * 
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/add/GitAddCommand.java
b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/add/GitAddCommand.java
index 21ad47607..37980e538 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/add/GitAddCommand.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/add/GitAddCommand.java
@@ -19,6 +19,12 @@
  * under the License.
  */
 
+import java.io.File;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
 import org.apache.commons.io.FilenameUtils;
 import org.apache.maven.scm.ScmException;
 import org.apache.maven.scm.ScmFile;
@@ -36,12 +42,6 @@
 import org.codehaus.plexus.util.cli.CommandLineUtils;
 import org.codehaus.plexus.util.cli.Commandline;
 
-import java.io.File;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
 /**
  * @author <a href="mailto:struberg@yahoo.de">Mark Struberg</a>
  */
@@ -139,12 +139,11 @@ public static Commandline createCommandLine( File workingDirectory,
List<File> f
 
         // use this separator to make clear that the following parameters are files and not
revision info.
         cl.createArg().setValue( "--" );
-
-        GitCommandLineUtils.addTarget( cl, files );
+        GitCommandLineUtils.addTargetPattern( cl, files );
 
         return cl;
     }
-
+    
     private AddScmResult executeAddFileSet( ScmFileSet fileSet )
         throws ScmException
     {
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/checkin/GitCheckInCommand.java
b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/checkin/GitCheckInCommand.java
index e30aae0c3..42c471880 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/checkin/GitCheckInCommand.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/checkin/GitCheckInCommand.java
@@ -251,7 +251,7 @@ public static Commandline createCommitCommandLine( GitScmProviderRepository
repo
         else
         {
             // specify exactly which files to commit
-            GitCommandLineUtils.addTarget( cl, fileSet.getFileList() );
+            GitCommandLineUtils.addTargetPattern( cl, fileSet.getFileList() );
         }
 
         if ( GitUtil.getSettings().isCommitNoVerify() )


 

----------------------------------------------------------------
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:
users@infra.apache.org


> mvn release:prepare fails if the command line is too long on windows
> --------------------------------------------------------------------
>
>                 Key: SCM-714
>                 URL: https://issues.apache.org/jira/browse/SCM-714
>             Project: Maven SCM
>          Issue Type: Bug
>          Components: maven-scm-provider-gitexe
>    Affects Versions: 1.8.1
>            Reporter: Felix Simmendinger
>            Assignee: Robert Scholte
>            Priority: Blocker
>
> The issue from SCM-697 does not solve the issue as the gitprovider is not using the add
command but the checkin command during a release.



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

Mime
View raw message