always add .git to Git URL
authorPavel Sher <pavel.sher@gmail.com>
Thu, 16 Jan 2014 12:06:32 +0000 (13:06 +0100)
committerPavel Sher <pavel.sher@gmail.com>
Thu, 16 Jan 2014 12:06:32 +0000 (13:06 +0100)
git-server/src/jetbrains/buildServer/buildTriggers/vcs/git/GitUrlSupport.java
git-tests/src/jetbrains/buildServer/buildTriggers/vcs/git/tests/GitUrlSupportTest.java

index 6a5929e09f3c778d0168d20a3e7b9d6eeb13c888..7db1ec448fa07ff1e5687122b9d6cb3155f33f7a 100644 (file)
@@ -60,6 +60,10 @@ public class GitUrlSupport implements UrlSupport {
       return props;
 
     try {
+      if (!fetchUrl.endsWith(".git")) {
+        props.put(Constants.FETCH_URL, fetchUrl + ".git");
+      }
+
       myGitSupport.testConnection(new VcsRootImpl(-1, Constants.VCS_NAME, props));
       return props;
     } catch (VcsException e) {
index 2938347a4b5ceed1f2dd9f75aa0b6bbf906549f3..7210daf3bf120102e8267e5e4c9f815178f16851 100644 (file)
@@ -156,6 +156,14 @@ public class GitUrlSupportTest extends BaseTestCase {
     assertEquals("pwd1", root.getProperty(Constants.PASSWORD));
   }
 
+  @Test
+  public void url_without_git_suffix() throws Exception {
+    VcsUrl url = new VcsUrl("https://github.com/hhariri/wasabi");
+    GitVcsRoot root = toGitRoot(url);
+
+    assertEquals("https://github.com/hhariri/wasabi.git", root.getProperty(Constants.FETCH_URL));
+  }
+
   @Test
   public void http_protocol_svn_repo() throws Exception {
     VcsUrl url = new VcsUrl("http://svn.jetbrains.org/teamcity/plugins/xml-tests-reporting/trunk/");