Author: olamy
Date: Wed Apr 29 21:59:38 2009
New Revision: 769959

URL: http://svn.apache.org/viewvc?rev=769959&view=rev
Log:
[SCM-464] gitexe GitAddCommand should use '--' to separate the files from the 
options and version info
Submitted by Mark Struberg

Added:
    
maven/scm/trunk/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/add/
    
maven/scm/trunk/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/add/GitExeAddCommandTest.java
   (with props)
Modified:
    
maven/scm/trunk/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

Modified: 
maven/scm/trunk/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
URL: 
http://svn.apache.org/viewvc/maven/scm/trunk/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?rev=769959&r1=769958&r2=769959&view=diff
==============================================================================
--- 
maven/scm/trunk/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
 (original)
+++ 
maven/scm/trunk/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
 Wed Apr 29 21:59:38 2009
@@ -113,6 +113,9 @@
     {
         Commandline cl = GitCommandLineUtils.getBaseGitCommandLine( 
workingDirectory, "add" );
 
+        // use this separator to make clear that the following parameters are 
files and not revision info.
+        cl.createArg().setValue( "--" );
+        
         GitCommandLineUtils.addTarget( cl, files );
 
         return cl;

Added: 
maven/scm/trunk/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/add/GitExeAddCommandTest.java
URL: 
http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/add/GitExeAddCommandTest.java?rev=769959&view=auto
==============================================================================
--- 
maven/scm/trunk/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/add/GitExeAddCommandTest.java
 (added)
+++ 
maven/scm/trunk/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/add/GitExeAddCommandTest.java
 Wed Apr 29 21:59:38 2009
@@ -0,0 +1,73 @@
+package org.apache.maven.scm.provider.git.gitexe.command.add;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.maven.scm.ScmTestCase;
+import org.codehaus.plexus.util.cli.Commandline;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Check if the {...@code GitAddCommand#createCommandLine(File, List)} returns 
the correct
+ * command line execution string.
+ * @author <a href="mailto:strub...@yahoo.de";>Mark Struberg</a>
+ * @version $Id$
+ */
+public class GitExeAddCommandTest 
+    extends ScmTestCase 
+{
+    
+    public void testAddCommandSingleFile() throws Exception
+    {
+        List/*File*/ files = new ArrayList();
+        
+        files.add( new File( "myFile.java" ) );
+        
+        testCommandLine( "scm:git:http://foo.com/git";, files, "git add -- 
myFile.java" );
+    }
+    
+    public void testAddCommandMultipleFiles() throws Exception
+    {
+        List/*File*/ files = new ArrayList();
+        
+        files.add( new File( "myFile.java" ) );
+        files.add( new File( "myFile2.java" ) );
+        files.add( new File( "myFile3.java" ) );
+        
+        testCommandLine( "scm:git:http://foo.com/git";, files, "git add -- 
myFile.java myFile2.java myFile3.java" );
+    }
+    
+    // ----------------------------------------------------------------------
+    // private helper functions
+    // ----------------------------------------------------------------------
+
+    private void testCommandLine( String scmUrl, List files, String 
commandLine )
+        throws Exception
+    {
+        File workingDirectory = getTestFile( "target/git-add-command-test" );
+
+        Commandline cl = GitAddCommand.createCommandLine(workingDirectory, 
files );
+
+        assertCommandLine( commandLine, workingDirectory, cl );
+    }
+
+}

Propchange: 
maven/scm/trunk/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/add/GitExeAddCommandTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/scm/trunk/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/add/GitExeAddCommandTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Revision Id


Reply via email to