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

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

asfgit closed pull request #30: Fix for SCM-714: mvn release:prepare fails if 
the command line is too long on windows
URL: https://github.com/apache/maven-scm/pull/30
 
 
   

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/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..b9622797c 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
@@ -38,6 +38,7 @@
 import 
org.apache.maven.scm.provider.git.gitexe.command.status.GitStatusCommand;
 import 
org.apache.maven.scm.provider.git.gitexe.command.status.GitStatusConsumer;
 import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.Os;
 import org.codehaus.plexus.util.cli.CommandLineUtils;
 import org.codehaus.plexus.util.cli.Commandline;
 
@@ -45,6 +46,7 @@
 import java.io.IOException;
 import java.net.URI;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 
 /**
@@ -66,7 +68,7 @@ protected CheckInScmResult executeCheckInCommand( 
ScmProviderRepository repo, Sc
         CommandLineUtils.StringStreamConsumer stderr = new 
CommandLineUtils.StringStreamConsumer();
         CommandLineUtils.StringStreamConsumer stdout = new 
CommandLineUtils.StringStreamConsumer();
 
-        int exitCode;
+        int exitCode = -1;
 
         File messageFile = FileUtils.createTempFile( "maven-scm-", ".commit", 
null );
         try
@@ -86,9 +88,28 @@ protected CheckInScmResult executeCheckInCommand( 
ScmProviderRepository repo, Sc
                 // if specific fileSet is given, we have to git-add them first
                 // otherwise we will use 'git-commit -a' later
 
-                Commandline clAdd = GitAddCommand.createCommandLine( 
fileSet.getBasedir(), fileSet.getFileList() );
+                Commandline clAdd = null;
 
-                exitCode = GitCommandLineUtils.execute( clAdd, stdout, stderr, 
getLogger() );
+                //SCM-714: Workaround for the Windows terminal command limit
+                if ( Os.isFamily( Os.FAMILY_WINDOWS ) ) 
+                {
+                    for ( File file: fileSet.getFileList() ) 
+                    {
+                        clAdd = GitAddCommand.createCommandLine( 
fileSet.getBasedir(), 
+                                                                 
Collections.singletonList( file ) );
+                        exitCode = GitCommandLineUtils.execute( clAdd, stdout, 
stderr, getLogger() );
+                        
+                        if ( exitCode != 0 ) 
+                        {
+                            break;
+                        }
+                    }
+                } 
+                else 
+                {
+                    clAdd = GitAddCommand.createCommandLine( 
fileSet.getBasedir(), fileSet.getFileList() );
+                    exitCode = GitCommandLineUtils.execute( clAdd, stdout, 
stderr, getLogger() );
+                }
 
                 if ( exitCode != 0 )
                 {
@@ -248,11 +269,6 @@ public static Commandline createCommitCommandLine( 
GitScmProviderRepository repo
             // commit all tracked files
             cl.createArg().setValue( "-a" );
         }
-        else
-        {
-            // specify exactly which files to commit
-            GitCommandLineUtils.addTarget( 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:
us...@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)

Reply via email to