michael-o commented on code in PR #159:
URL: https://github.com/apache/maven-scm/pull/159#discussion_r929268561


##########
maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/GitCommandLineUtils.java:
##########
@@ -90,28 +95,36 @@ public static void addTarget( Commandline cl, List<File> 
files )
     }
 
    /**
-    *
+    * Use this only for command not requiring environment variables (i.e. 
local commands).
     * @param workingDirectory
     * @param command
     * @return TODO
     */
    public static Commandline getBaseGitCommandLine( File workingDirectory, 
String command )
    {
-       return getBaseGitCommandLine( workingDirectory, command, 
Collections.emptyMap() );
+       return getBaseGitCommandLine( workingDirectory, command, null, null );
    }
 
     /**
-     *
+     * Use this for commands requiring environment variables (i.e. remote 
commands).
      * @param workingDirectory
      * @param command
      * @param environment
      * @return TODO
      */
     public static Commandline getBaseGitCommandLine( File workingDirectory, 
String command,
+                                                     GitScmProviderRepository 
repository,
                                                      Map<String, String> 
environment )
     {
         Commandline cl = getAnonymousBaseGitCommandLine( workingDirectory, 
command );
-        environment.forEach( cl::addEnvironment );
+        if ( repository != null ) 
+        {
+            prepareEnvVariablesForRepository( repository, environment 
).forEach( cl::addEnvironment );
+        }
+        else if ( environment != null )
+        {
+            environment.forEach( cl::addEnvironment );
+        }

Review Comment:
   argggggggggggggg...Commandline isn't flexible enough here. Looks OK to me 
since we cannot get a map from `Commandline`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to