jira-importer commented on issue #908:
URL: https://github.com/apache/maven-scm/issues/908#issuecomment-2964632443

   **[David 
SPORN](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=sporniket)** 
commented
   
   _This is a copy of my comment on the issue 
[MRELEASE-701](https://jira.codehaus.org/browse/MRELEASE-701) _
   
   Found the root cause :
   
   * **module :** maven-scm-provider-gitexe-1.9.2.jar
   * **package :** org.apache.maven.scm.provider.git.gitexe.command
   * **Class#function :** GitCommandLineUtils#addTarget( Commandline cl, 
List\<File> files ), around line 57
   
   In this function, file names are processed to remove a common prefix, that 
is the path of the working directory :
   
   ```
       public static void addTarget( Commandline cl, List<File> files )
       {
           if ( files == null || files.isEmpty() )
           {
               return;
           }
           final File workingDirectory = cl.getWorkingDirectory();
           try
           {
               final String canonicalWorkingDirectory = 
workingDirectory.getCanonicalPath();
               for ( File file : files )
               {
                   String relativeFile = file.getPath();
                   
                   final String canonicalFile = file.getCanonicalPath();
                   if ( canonicalFile.startsWith( canonicalWorkingDirectory ) )
                   {
                       // so we can omit the starting characters
                       relativeFile = canonicalFile.substring( 
canonicalWorkingDirectory.length() );
   
                       if ( relativeFile.startsWith( File.separator ) )
                       {
                           relativeFile = relativeFile.substring( 
File.separator.length() );
                       }
                   }
   
                   // no setFile() since this screws up the working directory!
                   cl.createArg().setValue( relativeFile );
               }
           }
           catch ( IOException ex )
           {
               throw new IllegalArgumentException( "Could not get canonical 
paths for workingDirectory = "
                   + workingDirectory + " or files=" + files, ex );
           }
       }
   ```
   
   This behaviour works well with a project organisation that follows maven 
convention, but in the case of a flat organisation and projects folder names 
being the name of the parent project + prefix, we get the observed result.
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to