maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject git commit: [SCM-697] git add fail on windows when a lot of files to add.
Date Fri, 12 Oct 2012 20:39:22 GMT
Updated Branches:
  refs/heads/master 006ea5222 -> 6a73560a4


[SCM-697] git add fail on windows when a lot of files to add.


Project: http://git-wip-us.apache.org/repos/asf/maven-scm/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-scm/commit/6a73560a
Tree: http://git-wip-us.apache.org/repos/asf/maven-scm/tree/6a73560a
Diff: http://git-wip-us.apache.org/repos/asf/maven-scm/diff/6a73560a

Branch: refs/heads/master
Commit: 6a73560a4f36fb00d919c371899266b4e58b73d1
Parents: 006ea52
Author: olivier lamy <olamy@apache.org>
Authored: Fri Oct 12 22:39:02 2012 +0200
Committer: olivier lamy <olamy@apache.org>
Committed: Fri Oct 12 22:39:02 2012 +0200

----------------------------------------------------------------------
 .../maven-scm-provider-gitexe/pom.xml              |    4 +
 .../git/gitexe/command/add/GitAddCommand.java      |   44 ++++++++++++---
 pom.xml                                            |    5 ++
 3 files changed, 44 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-scm/blob/6a73560a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/pom.xml
----------------------------------------------------------------------
diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/pom.xml
b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/pom.xml
index bb8742f..82e3a48 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/pom.xml
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/pom.xml
@@ -38,6 +38,10 @@
       <groupId>regexp</groupId>
       <artifactId>regexp</artifactId>
     </dependency>
+    <dependency>
+      <groupId>commons-io</groupId>
+      <artifactId>commons-io</artifactId>
+    </dependency>
 
     <!-- Test -->
     <dependency>

http://git-wip-us.apache.org/repos/asf/maven-scm/blob/6a73560a/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
----------------------------------------------------------------------
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 e3168fa..04d6bf7 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,10 +19,7 @@ package org.apache.maven.scm.provider.git.gitexe.command.add;
  * under the License.
  */
 
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
+import org.apache.commons.io.FileUtils;
 import org.apache.maven.scm.ScmException;
 import org.apache.maven.scm.ScmFile;
 import org.apache.maven.scm.ScmFileSet;
@@ -35,18 +32,25 @@ import org.apache.maven.scm.provider.git.gitexe.command.GitCommandLineUtils;
 import org.apache.maven.scm.provider.git.gitexe.command.status.GitStatusCommand;
 import org.apache.maven.scm.provider.git.gitexe.command.status.GitStatusConsumer;
 import org.apache.maven.scm.provider.git.repository.GitScmProviderRepository;
+import org.codehaus.plexus.util.Os;
 import org.codehaus.plexus.util.cli.CommandLineUtils;
 import org.codehaus.plexus.util.cli.Commandline;
 
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * @author <a href="mailto:struberg@yahoo.de">Mark Struberg</a>
- *
  */
 public class GitAddCommand
     extends AbstractAddCommand
     implements GitCommand
 {
-    /** {@inheritDoc} */
+    /**
+     * {@inheritDoc}
+     */
     protected ScmResult executeAddCommand( ScmProviderRepository repo, ScmFileSet fileSet,
String message,
                                            boolean binary )
         throws ScmException
@@ -63,9 +67,8 @@ public class GitAddCommand
         CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
         CommandLineUtils.StringStreamConsumer stdout = new CommandLineUtils.StringStreamConsumer();
 
-        int exitCode;
+        int exitCode = GitCommandLineUtils.execute( cl, stdout, stderr, getLogger() );
 
-        exitCode = GitCommandLineUtils.execute( cl, stdout, stderr, getLogger() );
         if ( exitCode != 0 )
         {
             return new AddScmResult( cl.toString(), "The git-add command failed.", stderr.getOutput(),
false );
@@ -111,9 +114,32 @@ public class GitAddCommand
 
         // use this separator to make clear that the following parameters are files and not
revision info.
         cl.createArg().setValue( "--" );
-        
+
         GitCommandLineUtils.addTarget( cl, files );
 
+        if ( Os.isFamily( Os.FAMILY_WINDOWS ) )
+        {
+            try
+            {
+                // TODO cleanup this file !!!
+                File tmpFile = File.createTempFile( "git-add", "bat" );
+                FileUtils.write( tmpFile, cl.toString() );
+
+                cl = new Commandline();
+
+                cl.setExecutable( "call" );
+
+                cl.createArg().setValue( tmpFile.getAbsolutePath() );
+
+                return cl;
+            }
+            catch ( IOException e )
+            {
+                throw new ScmException( e.getMessage(), e );
+            }
+
+        }
+
         return cl;
     }
 

http://git-wip-us.apache.org/repos/asf/maven-scm/blob/6a73560a/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 12af2f3..80d0625 100644
--- a/pom.xml
+++ b/pom.xml
@@ -260,6 +260,11 @@
         <artifactId>commons-lang</artifactId>
         <version>2.6</version>
       </dependency>
+      <dependency>
+        <groupId>commons-io</groupId>
+        <artifactId>commons-io</artifactId>
+        <version>2.2</version>
+      </dependency>
 
       <!-- Test -->
       <dependency>


Mime
View raw message