maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject [2/3] maven-scm git commit: [SCM-828] support @ in username of scm url fixed #47 Submitted by Guy Chauliac
Date Fri, 10 Jun 2016 03:40:43 GMT
[SCM-828] support @ in username of scm url
fixed #47
Submitted by Guy Chauliac

Signed-off-by: olivier lamy <olamy@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/maven-scm/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-scm/commit/2e3fd542
Tree: http://git-wip-us.apache.org/repos/asf/maven-scm/tree/2e3fd542
Diff: http://git-wip-us.apache.org/repos/asf/maven-scm/diff/2e3fd542

Branch: refs/heads/master
Commit: 2e3fd542d3f02afc1d5f8cbcddfa874b2cc5dad6
Parents: ab7265f
Author: olivier lamy <olamy@apache.org>
Authored: Fri Jun 10 13:38:54 2016 +1000
Committer: olivier lamy <olamy@apache.org>
Committed: Fri Jun 10 13:38:54 2016 +1000

----------------------------------------------------------------------
 .../provider/git/repository/GitScmProviderRepository.java |  3 ++-
 .../git/repository/GitScmProviderRepositoryTest.java      | 10 ++++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-scm/blob/2e3fd542/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/main/java/org/apache/maven/scm/provider/git/repository/GitScmProviderRepository.java
----------------------------------------------------------------------
diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/main/java/org/apache/maven/scm/provider/git/repository/GitScmProviderRepository.java
b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/main/java/org/apache/maven/scm/provider/git/repository/GitScmProviderRepository.java
index a1a2b62..2ffb480 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/main/java/org/apache/maven/scm/provider/git/repository/GitScmProviderRepository.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/main/java/org/apache/maven/scm/provider/git/repository/GitScmProviderRepository.java
@@ -24,6 +24,7 @@ import org.apache.maven.scm.provider.ScmProviderRepository;
 import org.apache.maven.scm.provider.ScmProviderRepositoryWithHost;
 
 import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
 import java.net.URLEncoder;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -381,7 +382,7 @@ public class GitScmProviderRepository
         throws ScmException
     {
         // extract user information
-        int indexAt = url.indexOf( '@' );
+        int indexAt = url.lastIndexOf( '@' );
         if ( indexAt >= 0 )
         {
             String userInfo = url.substring( 0, indexAt );

http://git-wip-us.apache.org/repos/asf/maven-scm/blob/2e3fd542/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/test/java/org/apache/maven/scm/provider/git/repository/GitScmProviderRepositoryTest.java
----------------------------------------------------------------------
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 c5fd6aa..134247a 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
@@ -198,6 +198,8 @@ public class GitScmProviderRepositoryTest
         testUrl( "scm:git:http://username@gitrepos.apache.org:8800/pmgt/trunk",
                  null, "http://username@gitrepos.apache.org:8800/pmgt/trunk",
                  null, "username", null, "gitrepos.apache.org", 8800, null);
+        
+
 
         testUrl( "scm:git:https://username@gitrepos.apache.org:20443/pmgt/trunk",
                  null, "https://username@gitrepos.apache.org:20443/pmgt/trunk",
@@ -214,6 +216,14 @@ public class GitScmProviderRepositoryTest
         testUrl( "scm:git:ssh://username:password@gitrepos.apache.org/pmgt/trunk",
                  null, "ssh://username:password@gitrepos.apache.org/pmgt/trunk", 
                  null, "username", "password", "gitrepos.apache.org", 0, null);
+        
+    }
+    
+    public void testUsernameWithAtAndPasswordInUrl() throws ScmRepositoryException, Exception{
+        testUrl( "scm:git:http://username@site.com:password@gitrepos.apache.org:8800/pmgt/trunk",
+            null, "http://username%40site.com:password@gitrepos.apache.org:8800/pmgt/trunk",
+            null, "username@site.com", "password", "gitrepos.apache.org", 8800, null);
+
     }
 
     // ----------------------------------------------------------------------


Mime
View raw message