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 #77: SCM-791, SCM-815: fixes for Windows paths in git command line
Date Sat, 18 Aug 2018 19:48:44 GMT
asfgit closed pull request #77: SCM-791,SCM-815: fixes for Windows paths in git command line
URL: https://github.com/apache/maven-scm/pull/77
 
 
   

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/test/java/org/apache/maven/scm/provider/git/repository/GitScmProviderRepositoryTest.java
b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/test/java/org/apache/maven/scm/provider/git/repository/GitScmProviderRepositoryTest.java
index a5400ab45..2efe7555b 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/test/java/org/apache/maven/scm/provider/git/repository/GitScmProviderRepositoryTest.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/test/java/org/apache/maven/scm/provider/git/repository/GitScmProviderRepositoryTest.java
@@ -109,6 +109,7 @@ public void testLegalHttpsURL()
     public void testLegalFileWindowsURL()
             throws Exception
     {
+        // FIXME This URL is invalid, hell knows why Git accepts it. It should be by us right
away
         testUrl( "scm:git:file://c:\\tmp\\repo", null, "file://c:\\tmp\\repo", null, null,
null, null, 0, 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 596177a25..2096cadfc 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
@@ -141,7 +141,8 @@ protected String getRepositoryURL( File path )
         // Note: I need to supply just 1 absolute path, but ScmFileSet won't let me without
         // a basedir (which isn't used here anyway), so use a dummy file.
         // and a dummy ScmProviderRepository
-        InfoScmResult result = info( new GitScmProviderRepository( path.getPath() ), new
ScmFileSet( path ), null );
+        InfoScmResult result = info( new GitScmProviderRepository( path.toPath().toUri().toASCIIString()
),
+                                     new ScmFileSet( path ), null );
 
         if ( result.getInfoItems().size() != 1 )
         {
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/GitCommandLineUtils.java
b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/GitCommandLineUtils.java
index 4f23195ec..bb1dad113 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/GitCommandLineUtils.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/GitCommandLineUtils.java
@@ -19,6 +19,8 @@
  * under the License.
  */
 
+import org.apache.commons.io.FilenameUtils;
+
 import org.apache.maven.scm.ScmException;
 import org.apache.maven.scm.log.ScmLogger;
 import org.apache.maven.scm.provider.git.util.GitUtil;
@@ -34,7 +36,7 @@
 
 /**
  * Command line construction utility.
- * 
+ *
  * @author Brett Porter
  * @author <a href="mailto:struberg@yahoo.de">Mark Struberg</a>
  *
@@ -73,7 +75,7 @@ public static void addTarget( Commandline cl, List<File> files )
                 }
 
                 // no setFile() since this screws up the working directory!
-                cl.createArg().setValue( relativeFile );
+                cl.createArg().setValue( FilenameUtils.separatorsToUnix( relativeFile ) );
             }
         }
         catch ( IOException ex )
@@ -84,7 +86,7 @@ public static void addTarget( Commandline cl, List<File> files )
     }
 
     /**
-     * 
+     *
      * @param workingDirectory
      * @param command
      * @return
@@ -97,7 +99,7 @@ public static Commandline getBaseGitCommandLine( File workingDirectory,
String c
     /**
      * Creates a {@link Commandline} for which the toString() do not display
      * password.
-     * 
+     *
      * @param workingDirectory
      * @param command
      * @return CommandLine with anonymous output.
@@ -176,4 +178,4 @@ public static int execute( Commandline cl, CommandLineUtils.StringStreamConsumer
         return exitCode;
     }
 
-}
\ No newline at end of file
+}
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/changelog/GitChangeLogCommand.java
b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/changelog/GitChangeLogCommand.java
index fe62ef6e9..e4879ba25 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/changelog/GitChangeLogCommand.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/changelog/GitChangeLogCommand.java
@@ -236,7 +236,7 @@ else if ( version != null )
         // We have to report only the changes of the current project.
         // This is needed for child projects, otherwise we would get the changelog of the

         // whole parent-project including all childs.
-        cl.createArg().setFile( workingDirectory );
+        cl.createArg().setValue( "." );
         
         return cl;
     }
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/checkout/GitCheckOutCommand.java
b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/checkout/GitCheckOutCommand.java
index d2e8613c7..7fcda9ccb 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/checkout/GitCheckOutCommand.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/checkout/GitCheckOutCommand.java
@@ -194,7 +194,7 @@ private Commandline createCloneCommand( GitScmProviderRepository repository,
Fil
 
         cl.createArg().setValue( repository.getFetchUrl() );
 
-        cl.createArg().setFile( workingDirectory );
+        cl.createArg().setValue( workingDirectory.getName() );
 
         return cl;
     }
@@ -223,8 +223,8 @@ private Commandline createPullCommand( GitScmProviderRepository repository,
File
                 // A tag will not be pulled but we only fetch all the commits from the upstream
repo
                 // This is done because checking out a tag might not happen on the current
branch
                 // but create a 'detached HEAD'.
-                // In fact, a tag in git may be in multiple branches. This occurs if 
-                // you create a branch after the tag has been created 
+                // In fact, a tag in git may be in multiple branches. This occurs if
+                // you create a branch after the tag has been created
                 cl = GitCommandLineUtils.getBaseGitCommandLine( workingDirectory, "fetch"
);
 
                 cl.createArg().setValue( repository.getFetchUrl() );
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/info/GitInfoConsumer.java
b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/info/GitInfoConsumer.java
index 3ef1cc382..3b236ebf2 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/info/GitInfoConsumer.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/info/GitInfoConsumer.java
@@ -47,7 +47,7 @@ public GitInfoConsumer( ScmLogger logger, ScmFileSet scmFileSet )
         super( logger );
         this.scmFileSet = scmFileSet;
     }
-    
+
     /**
      * @see org.codehaus.plexus.util.cli.StreamConsumer#consumeLine(java.lang.String)
      */
@@ -57,14 +57,14 @@ public void consumeLine( String line )
         {
             getLogger().debug( "consume line " + line );
         }
-        
+
         if ( infoItems.isEmpty() )
         {
             if ( !StringUtils.isEmpty( line ) )
             {
                 InfoItem infoItem = new InfoItem();
                 infoItem.setRevision( StringUtils.trim( line ) );
-                infoItem.setURL( scmFileSet.getBasedir().getPath() );
+                infoItem.setURL( scmFileSet.getBasedir().toPath().toUri().toASCIIString()
);
                 infoItems.add( infoItem );
             }
         }
diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/GitCommandLineUtilsAddTargetTest.java
b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/GitCommandLineUtilsAddTargetTest.java
index 65749222b..5005ceec6 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/GitCommandLineUtilsAddTargetTest.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/GitCommandLineUtilsAddTargetTest.java
@@ -65,7 +65,7 @@ public void testAddTargetWindows()
         // https://jira.codehaus.org/browse/SCM-667
         final List<File> filesToAdd = Arrays.asList( new File( "C:\\prj\\pom.xml" ),
             new File( "c:\\prj\\mod1\\pom.xml" ) );
-        final String expectedArguments = "[add, pom.xml, mod1\\pom.xml]";
+        final String expectedArguments = "[add, pom.xml, mod1/pom.xml]";
         check( workingDir, filesToAdd, expectedArguments );
     }
 
@@ -108,4 +108,4 @@ private boolean runsOnWindows()
     {
         return Os.isFamily( Os.FAMILY_WINDOWS );
     }
-}
\ No newline at end of file
+}
diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/changelog/GitChangeLogCommandTest.java
b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/changelog/GitChangeLogCommandTest.java
index ecc6086fa..fd54a6220 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/changelog/GitChangeLogCommandTest.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/changelog/GitChangeLogCommandTest.java
@@ -53,7 +53,7 @@ public void testCommandLineNoDates()
     {
         testCommandLine( "scm:git:http://foo.com/git", null, (Date) null, (Date) null, 40,
                          "git whatchanged --date=iso --max-count=40"
-                         + " -- " + StringUtils.quoteAndEscape( workingDirectory.getPath(),
'"' ) );
+                         + " -- ." );
     }
 
     public void testCommandLineNoDatesLimitedCount()
@@ -61,7 +61,7 @@ public void testCommandLineNoDatesLimitedCount()
     {
         testCommandLine( "scm:git:http://foo.com/git", null, (Date) null, (Date) null,
                          "git whatchanged --date=iso"
-                         + " -- " + StringUtils.quoteAndEscape( workingDirectory.getPath(),
'"' ) );
+                         + " -- ." );
     }
 
     public void testCommandLineWithDates()
@@ -72,7 +72,7 @@ public void testCommandLineWithDates()
 
         testCommandLine( "scm:git:http://foo.com/git", null, startDate, endDate,
                          "git whatchanged \"--since=2003-09-10 00:00:00 +0000\" \"--until=2007-10-10
00:00:00 +0000\" --date=iso" 
-                         + " -- " + StringUtils.quoteAndEscape( workingDirectory.getPath(),
'"' ) );
+                         + " -- ." );
     }
 
     public void testCommandLineStartDateOnly()
@@ -82,7 +82,7 @@ public void testCommandLineStartDateOnly()
 
         testCommandLine( "scm:git:http://foo.com/git", null, startDate, null,
                          "git whatchanged \"--since=2003-09-10 01:01:01 +0000\" --date=iso"

-                         + " -- " + StringUtils.quoteAndEscape( workingDirectory.getPath(),
'"' ) );
+                         + " -- ." );
     }
 
     public void testCommandLineDateFormat()
@@ -93,7 +93,7 @@ public void testCommandLineDateFormat()
 
         testCommandLine( "scm:git:http://foo.com/git", null, startDate, endDate,
                          "git whatchanged \"--since=2003-09-10 01:01:01 +0000\" \"--until=2005-11-13
23:23:23 +0000\" --date=iso"
-                         + " -- " + StringUtils.quoteAndEscape( workingDirectory.getPath(),
'"' ) );
+                         + " -- ." );
     }
 
     public void testCommandLineDateVersionRanges()
@@ -104,7 +104,7 @@ public void testCommandLineDateVersionRanges()
     
         testCommandLine( "scm:git:http://foo.com/git", null, startDate, endDate, new ScmRevision(
"1" ), new ScmRevision( "10" ),
                          "git whatchanged \"--since=2003-09-10 01:01:01 +0000\" \"--until=2005-11-13
23:23:23 +0000\" --date=iso 1..10"
-                         + " -- " + StringUtils.quoteAndEscape( workingDirectory.getPath(),
'"' ) );
+                         + " -- ." );
     }
     
     public void testCommandLineEndDateOnly()
@@ -115,7 +115,7 @@ public void testCommandLineEndDateOnly()
         // Only specifying end date should print no dates at all
         testCommandLine( "scm:git:http://foo.com/git", null, null, endDate,
                          "git whatchanged \"--until=2003-11-10 00:00:00 +0000\" --date=iso"
-                         + " -- " + StringUtils.quoteAndEscape( workingDirectory.getPath(),
'"' ) );
+                         + " -- ." );
     }
 
     public void testCommandLineWithBranchNoDates()
@@ -123,7 +123,7 @@ public void testCommandLineWithBranchNoDates()
     {
         testCommandLine( "scm:git:http://foo.com/git", new ScmBranch( "my-test-branch" ),
(Date) null, (Date) null, 
                          "git whatchanged --date=iso my-test-branch"
-                         + " -- " + StringUtils.quoteAndEscape( workingDirectory.getPath(),
'"' ) );
+                         + " -- ." );
     }
 
 
@@ -132,7 +132,7 @@ public void testCommandLineWithStartVersion()
     {
         testCommandLine( "scm:git:http://foo.com/git", null, new ScmRevision( "1" ), null,

                          "git whatchanged --date=iso 1.."
-                         + " -- " + StringUtils.quoteAndEscape( workingDirectory.getPath(),
'"' ) );
+                         + " -- ." );
     }
 
     public void testCommandLineWithStartVersionAndEndVersion()
@@ -140,7 +140,7 @@ public void testCommandLineWithStartVersionAndEndVersion()
     {
         testCommandLine( "scm:git:http://foo.com/git", null, new ScmRevision( "1" ), new
ScmRevision( "10" ), 
                          "git whatchanged --date=iso 1..10"
-                         + " -- " + StringUtils.quoteAndEscape( workingDirectory.getPath(),
'"' ) );
+                         + " -- ." );
     }
 
     public void testCommandLineWithStartVersionAndEndVersionEquals()
@@ -148,7 +148,7 @@ public void testCommandLineWithStartVersionAndEndVersionEquals()
     {
         testCommandLine( "scm:git:http://foo.com/git", null, new ScmRevision( "1" ), new
ScmRevision( "1" ), 
                          "git whatchanged --date=iso 1..1"
-                         + " -- " + StringUtils.quoteAndEscape( workingDirectory.getPath(),
'"' ) );
+                         + " -- ." );
     }
 
     public void testCommandLineWithStartVersionAndEndVersionAndBranch()
@@ -156,7 +156,7 @@ public void testCommandLineWithStartVersionAndEndVersionAndBranch()
     {
         testCommandLine( "scm:git:http://foo.com/git", new ScmBranch( "my-test-branch" ),
new ScmRevision( "1" ), new ScmRevision( "10" ), 
                          "git whatchanged --date=iso 1..10 my-test-branch"
-                         + " -- " + StringUtils.quoteAndEscape( workingDirectory.getPath(),
'"' ) );
+                         + " -- ." );
     }
 
     // ----------------------------------------------------------------------
diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/checkin/GitCheckInCommandNoBranchTest.java
b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/checkin/GitCheckInCommandNoBranchTest.java
index e73e16379..d5f722b56 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/checkin/GitCheckInCommandNoBranchTest.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/checkin/GitCheckInCommandNoBranchTest.java
@@ -61,7 +61,7 @@ public void testCheckinNoBranch()
         FileUtils.deleteDirectory( repo );
         FileUtils.copyDirectoryStructure( repo_orig, repo );
 
-        ScmRepository scmRepository = getScmManager().makeScmRepository( "scm:git:file:///"
+ repo.getAbsolutePath() );
+        ScmRepository scmRepository = getScmManager().makeScmRepository( "scm:git:" + repo.toPath().toUri().toASCIIString()
);
 
         CheckOutScmResult checkOutScmResult = checkoutRepo( scmRepository );
 
diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/checkin/GitCheckInCommandTest.java
b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/checkin/GitCheckInCommandTest.java
index 3221fc677..4dccb9e81 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/checkin/GitCheckInCommandTest.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/checkin/GitCheckInCommandTest.java
@@ -65,7 +65,7 @@ public void testCommandLineWithoutTag()
     {
         if ( GitUtil.getSettings().isCommitNoVerify() )
         {
-            testCommandLine( "scm:git:http://foo.com/git/trunk", "git commit --verbose "
+ messageFileString + " -a" + " --no-verify" );    
+            testCommandLine( "scm:git:http://foo.com/git/trunk", "git commit --verbose "
+ messageFileString + " -a" + " --no-verify" );
         }
         else
         {
@@ -95,18 +95,18 @@ public void testCheckinAfterRename() throws Exception {
 
         GitScmTestUtils.initRepo("src/test/resources/repository/", getRepositoryRoot(), getWorkingDirectory());
 
-        ScmRepository scmRepository = getScmManager().makeScmRepository( "scm:git:file://"
+ repo.getAbsolutePath() );
+        ScmRepository scmRepository = getScmManager().makeScmRepository( "scm:git:" + repo.toPath().toUri().toASCIIString()
);
         checkoutRepoInto(checkedOutRepo, scmRepository);
 
         // Add a default user to the config
         GitScmTestUtils.setDefaultUser( checkedOutRepo );
 
         // Creating foo/bar/wine.xml
-        File fooDir = new File( checkedOutRepo.getAbsolutePath() + File.separator + "foo"
);
+        File fooDir = new File( checkedOutRepo.getAbsolutePath(), "foo" );
         fooDir.mkdir();
-        File barDir = new File(fooDir.getAbsolutePath() + File.separator + "bar");
+        File barDir = new File(fooDir.getAbsolutePath(), "bar");
         barDir.mkdir();
-        File wineFile = new File(barDir.getAbsolutePath() + File.separator + "wine.xml");
+        File wineFile = new File(barDir.getAbsolutePath(), "wine.xml");
         FileUtils.fileWrite( wineFile.getAbsolutePath(), "Lacoste castle" );
 
         // Adding and commiting file
@@ -116,9 +116,9 @@ public void testCheckinAfterRename() throws Exception {
         assertResultIsSuccess( checkInScmResult );
 
         // Cloning foo/bar/wine.xml to foo/newbar/wine.xml
-        File newBarDir = new File(fooDir.getAbsolutePath() + File.separator + "newbar");
+        File newBarDir = new File(fooDir.getAbsolutePath(), "newbar");
         newBarDir.mkdir();
-        File movedWineFile = new File(newBarDir.getAbsolutePath() + File.separator + "wine.xml");
+        File movedWineFile = new File(newBarDir.getAbsolutePath(), "wine.xml");
         FileUtils.copyFile(wineFile, movedWineFile);
 
         // Removing old file, adding new file and commiting...
diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/checkout/GitExeCheckOutCommandNoBranchTest.java
b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/checkout/GitExeCheckOutCommandNoBranchTest.java
index 0d1c959e4..c442d59b8 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/checkout/GitExeCheckOutCommandNoBranchTest.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/checkout/GitExeCheckOutCommandNoBranchTest.java
@@ -50,7 +50,7 @@ public void setUp()
         FileUtils.deleteDirectory( workingDirectory );
         repo = new File( "src/test/resources/repository_no_branch" );
 
-        scmRepository = getScmManager().makeScmRepository( "scm:git:file:///" + repo.getAbsolutePath()
);
+        scmRepository = getScmManager().makeScmRepository( "scm:git:" + repo.toPath().toUri().toASCIIString()
);
     }
 
     public void testCheckoutNoBranch()
diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/info/GitInfoCommandTckTest.java
b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/info/GitInfoCommandTckTest.java
index c06f3d614..7d853ebfc 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/info/GitInfoCommandTckTest.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/info/GitInfoCommandTckTest.java
@@ -50,7 +50,7 @@ public void testInfoCommand()
             provider.info( repository, new ScmFileSet( getRepositoryRoot() ), new CommandParameters()
);
         assertNotNull( result );
         assertEquals( "cd3c0dfacb65955e6fbb35c56cc5b1bf8ce4f767", result.getInfoItems().get(
0 ).getRevision() );
-        // 
+        //
     }
 
     public void testInfoCommandWithShortRevision()
diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gittest/src/main/java/org/apache/maven/scm/provider/git/GitScmTestUtils.java
b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gittest/src/main/java/org/apache/maven/scm/provider/git/GitScmTestUtils.java
index c62458fd7..284bff5a3 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gittest/src/main/java/org/apache/maven/scm/provider/git/GitScmTestUtils.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gittest/src/main/java/org/apache/maven/scm/provider/git/GitScmTestUtils.java
@@ -19,18 +19,15 @@
  * under the License.
  */
 
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+
 import junit.framework.Assert;
+
 import org.codehaus.plexus.PlexusTestCase;
 import org.codehaus.plexus.util.FileUtils;
-import org.codehaus.plexus.util.Os;
-import org.codehaus.plexus.util.StringUtils;
 import org.codehaus.plexus.util.cli.CommandLineException;
-import org.codehaus.plexus.util.cli.CommandLineUtils;
-import org.codehaus.plexus.util.cli.Commandline;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
 
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
@@ -79,37 +76,7 @@ public static void initRepo( String source, File repository, File workingDirecto
     public static String getScmUrl( File repositoryRootFile, String provider )
         throws CommandLineException
     {
-        String repositoryRoot = repositoryRootFile.getAbsolutePath();
-
-        // TODO: it'd be great to build this into CommandLineUtils somehow
-        // TODO: some way without a custom cygwin sys property?
-        if ( "true".equals( System.getProperty( "cygwin" ) ) )
-        {
-            Commandline cl = new Commandline();
-
-            cl.setExecutable( "cygpath" );
-
-            cl.createArg().setValue( "--unix" );
-
-            cl.createArg().setValue( repositoryRoot );
-
-            CommandLineUtils.StringStreamConsumer stdout = new CommandLineUtils.StringStreamConsumer();
-
-            int exitValue = CommandLineUtils.executeCommandLine( cl, stdout, null );
-
-            if ( exitValue != 0 )
-            {
-                throw new CommandLineException( "Unable to convert cygwin path, exit code
= " + exitValue );
-            }
-
-            repositoryRoot = stdout.getOutput().trim();
-        }
-        else if ( Os.isFamily( "windows" ) )
-        {
-            repositoryRoot = "/" + StringUtils.replace( repositoryRoot, "\\", "/" );
-        }
-
-        return "scm:" + provider + ":file://" + repositoryRoot;
+        return "scm:" + provider + ":" + repositoryRootFile.toPath().toUri().toASCIIString();
     }
 
 
diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gittest/src/main/java/org/apache/maven/scm/provider/git/command/changelog/GitChangeLogCommandTckTest.java
b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gittest/src/main/java/org/apache/maven/scm/provider/git/command/changelog/GitChangeLogCommandTckTest.java
index 1b42d94dd..330255705 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gittest/src/main/java/org/apache/maven/scm/provider/git/command/changelog/GitChangeLogCommandTckTest.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gittest/src/main/java/org/apache/maven/scm/provider/git/command/changelog/GitChangeLogCommandTckTest.java
@@ -48,7 +48,7 @@
     public void initRepo()
         throws Exception
     {
-        GitScmTestUtils.initRepo( "src/test/resources/linear-changelog/", getRepositoryRoot(),
getWorkingDirectory() );
+        GitScmTestUtils.initRepo( "src/test/resources/linear-changelog/", getRepositoryRoot(),
getWorkingCopy() );
     }
 
     @Override
diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gittest/src/main/java/org/apache/maven/scm/provider/git/command/update/GitUpdateCommandTckTest.java
b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gittest/src/main/java/org/apache/maven/scm/provider/git/command/update/GitUpdateCommandTckTest.java
index ff277b5ca..12583f653 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gittest/src/main/java/org/apache/maven/scm/provider/git/command/update/GitUpdateCommandTckTest.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gittest/src/main/java/org/apache/maven/scm/provider/git/command/update/GitUpdateCommandTckTest.java
@@ -37,7 +37,7 @@
     public void initRepo()
         throws Exception
     {
-        GitScmTestUtils.initRepo( "src/test/resources/repository/", getRepositoryRoot(),
getWorkingDirectory() );
+        GitScmTestUtils.initRepo( "src/test/resources/repository/", getRepositoryRoot(),
getWorkingCopy() );
     }
 
     @Override
diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-jgit/src/main/java/org/apache/maven/scm/provider/git/jgit/command/info/JGitInfoCommand.java
b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-jgit/src/main/java/org/apache/maven/scm/provider/git/jgit/command/info/JGitInfoCommand.java
index 488093eb2..b28b4f543 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-jgit/src/main/java/org/apache/maven/scm/provider/git/jgit/command/info/JGitInfoCommand.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-jgit/src/main/java/org/apache/maven/scm/provider/git/jgit/command/info/JGitInfoCommand.java
@@ -60,7 +60,7 @@ protected ScmResult executeCommand( ScmProviderRepository repository, ScmFileSet
 
             InfoItem infoItem = new InfoItem();
             infoItem.setRevision( StringUtils.trim( objectId.name() ) );
-            infoItem.setURL( basedir.getPath() );
+            infoItem.setURL( basedir.toPath().toUri().toASCIIString() );
 
             return new InfoScmResult( Collections.singletonList( infoItem ),
                                       new ScmResult( "JGit.resolve(HEAD)", "", objectId.toString(),
true ) );
diff --git a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svntest/src/main/java/org/apache/maven/scm/provider/svn/SvnScmTestUtils.java
b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svntest/src/main/java/org/apache/maven/scm/provider/svn/SvnScmTestUtils.java
index d52d61f3f..521bc83cc 100644
--- a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svntest/src/main/java/org/apache/maven/scm/provider/svn/SvnScmTestUtils.java
+++ b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svntest/src/main/java/org/apache/maven/scm/provider/svn/SvnScmTestUtils.java
@@ -22,7 +22,6 @@
 import junit.framework.Assert;
 import org.apache.maven.scm.ScmTestCase;
 import org.codehaus.plexus.util.FileUtils;
-import org.codehaus.plexus.util.Os;
 import org.codehaus.plexus.util.StringUtils;
 import org.codehaus.plexus.util.cli.CommandLineException;
 import org.codehaus.plexus.util.cli.CommandLineUtils;
@@ -55,7 +54,7 @@ public static void initializeRepository( File repositoryRoot )
         {
             FileUtils.deleteDirectory( repositoryRoot );
         }
-        
+
         Assert.assertFalse( "repositoryRoot still exists", repositoryRoot.exists() );
 
         Assert.assertTrue( "Could not make repository root directory: " + repositoryRoot.getAbsolutePath(),
@@ -132,36 +131,6 @@ private static void loadSvnDump( File repositoryRoot, InputStream dumpStream
)
     public static String getScmUrl( File repositoryRootFile )
         throws CommandLineException
     {
-        String repositoryRoot = repositoryRootFile.getAbsolutePath();
-
-        // TODO: it'd be great to build this into CommandLineUtils somehow
-        // TODO: some way without a custom cygwin sys property?
-        if ( "true".equals( System.getProperty( "cygwin" ) ) )
-        {
-            Commandline cl = new Commandline();
-
-            cl.setExecutable( "cygpath" );
-
-            cl.createArg().setValue( "--unix" );
-
-            cl.createArg().setValue( repositoryRoot );
-
-            CommandLineUtils.StringStreamConsumer stdout = new CommandLineUtils.StringStreamConsumer();
-
-            int exitValue = CommandLineUtils.executeCommandLine( cl, stdout, null );
-
-            if ( exitValue != 0 )
-            {
-                throw new CommandLineException( "Unable to convert cygwin path, exit code
= " + exitValue );
-            }
-
-            repositoryRoot = stdout.getOutput().trim();
-        }
-        else if ( Os.isFamily( "windows" ) )
-        {
-            repositoryRoot = "/" + StringUtils.replace( repositoryRoot, "\\", "/" );
-        }
-
-        return "scm:svn:file://" + repositoryRoot;
+        return "scm:svn:" + repositoryRootFile.toPath().toUri().toASCIIString();
     }
 }


 

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