maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] asfgit closed pull request #67: [SCM-869] fix gitexe list() implemented incorrectly
Date Fri, 04 May 2018 20:43:26 GMT
asfgit closed pull request #67: [SCM-869] fix gitexe list() implemented incorrectly
URL: https://github.com/apache/maven-scm/pull/67
 
 
   

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-git-commons/src/main/java/org/apache/maven/scm/provider/git/AbstractGitScmProvider.java
b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/main/java/org/apache/maven/scm/provider/git/AbstractGitScmProvider.java
index 3609335cd..b26f2688c 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/main/java/org/apache/maven/scm/provider/git/AbstractGitScmProvider.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/main/java/org/apache/maven/scm/provider/git/AbstractGitScmProvider.java
@@ -291,17 +291,6 @@ protected ScmResult executeCommand( GitCommand command, ScmProviderRepository
re
         return command.execute( repository, fileSet, parameters );
     }
 
-    protected abstract GitCommand getListCommand();
-
-    /** {@inheritDoc} */
-    public ListScmResult list( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters
parameters )
-        throws ScmException
-    {
-        GitCommand cmd = getListCommand();
-
-        return (ListScmResult) executeCommand( cmd, repository, fileSet, parameters );
-    }
-
     protected abstract GitCommand getInfoCommand();
 
     public InfoScmResult info( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters
parameters )
diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/test/java/org/apache/maven/scm/provider/git/TestGitScmProvider.java
b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/test/java/org/apache/maven/scm/provider/git/TestGitScmProvider.java
index 2f596b8b5..3f07e9a31 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/test/java/org/apache/maven/scm/provider/git/TestGitScmProvider.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/test/java/org/apache/maven/scm/provider/git/TestGitScmProvider.java
@@ -81,11 +81,6 @@ protected GitCommand getUpdateCommand()
         return null;
     }
 
-    protected GitCommand getListCommand()
-    {
-        return null;
-    }
-
     protected GitCommand getInfoCommand()
     {
         return null;
diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/GitExeScmProvider.java
b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/GitExeScmProvider.java
index 24283772f..8f61e86d0 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/GitExeScmProvider.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/GitExeScmProvider.java
@@ -117,12 +117,6 @@ protected GitCommand getUpdateCommand()
         return new GitUpdateCommand();
     }
 
-    /** {@inheritDoc} */
-    protected GitCommand getListCommand()
-    {
-        return new GitListCommand();
-    }
-
     /** {@inheritDoc} */
     public GitCommand getInfoCommand()
     {
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/list/GitListCommand.java
b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/list/GitListCommand.java
index 27a90f84e..ffe573347 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/list/GitListCommand.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/list/GitListCommand.java
@@ -19,63 +19,18 @@
  * under the License.
  */
 
-import org.apache.maven.scm.ScmException;
-import org.apache.maven.scm.ScmFileSet;
-import org.apache.maven.scm.ScmFileStatus;
-import org.apache.maven.scm.ScmVersion;
-import org.apache.maven.scm.command.list.AbstractListCommand;
-import org.apache.maven.scm.command.list.ListScmResult;
-import org.apache.maven.scm.provider.ScmProviderRepository;
-import org.apache.maven.scm.provider.git.command.GitCommand;
-import org.apache.maven.scm.provider.git.repository.GitScmProviderRepository;
+import java.io.File;
+
 import org.apache.maven.scm.provider.git.gitexe.command.GitCommandLineUtils;
-import org.codehaus.plexus.util.cli.CommandLineUtils;
+import org.apache.maven.scm.provider.git.repository.GitScmProviderRepository;
 import org.codehaus.plexus.util.cli.Commandline;
 
-import java.io.File;
-
 /**
  * @author <a href="mailto:struberg@yahoo.de">Mark Struberg</a>
  *
  */
 public class GitListCommand
-    extends AbstractListCommand
-    implements GitCommand
 {
-    /** {@inheritDoc} */
-    protected ListScmResult executeListCommand( ScmProviderRepository repo, ScmFileSet fileSet,
boolean recursive,
-                                                ScmVersion scmVersion )
-        throws ScmException
-    {
-        GitScmProviderRepository repository = (GitScmProviderRepository) repo;
-
-        if ( GitScmProviderRepository.PROTOCOL_FILE.equals( repository.getFetchInfo().getProtocol()
)
-            && repository.getFetchInfo().getPath().indexOf( fileSet.getBasedir().getPath()
) >= 0 )
-        {
-            throw new ScmException( "remote repository must not be the working directory"
);
-        }
-
-        int exitCode;
-
-        CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
-        GitListConsumer consumer = new GitListConsumer( getLogger(), fileSet.getBasedir().getParentFile(),
-                                                        ScmFileStatus.CHECKED_IN );
-
-        Commandline cl = createCommandLine( repository, fileSet.getBasedir() );
-
-        exitCode = GitCommandLineUtils.execute( cl, consumer, stderr, getLogger() );
-        if ( exitCode != 0 )
-        {
-            return new ListScmResult( cl.toString(), "The git-ls-files command failed.",
stderr.getOutput(), false );
-        }
-
-        return new ListScmResult( cl.toString(), consumer.getListedFiles() );
-    }
-
-    // ----------------------------------------------------------------------
-    //
-    // ----------------------------------------------------------------------
-
     public static Commandline createCommandLine( GitScmProviderRepository repository, File
workingDirectory )
     {
         Commandline cl = GitCommandLineUtils.getBaseGitCommandLine( workingDirectory, "ls-files"
);


 

----------------------------------------------------------------
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


With regards,
Apache Git Services

Mime
View raw message