Replace all '.git' with Constants.DOT_GIT_EXT
For making it easy to trace, replace all '.git' with Constants.DOT_GIT_EXT. Change-Id: I92f5fefe628b6dca50d7c1961d3456d3c0e141dd
This commit is contained in:
		@@ -39,6 +39,7 @@ import com.google.inject.internal.UniqueAnnotations;
 | 
				
			|||||||
import com.google.inject.servlet.ServletModule;
 | 
					import com.google.inject.servlet.ServletModule;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import org.eclipse.jgit.lib.Config;
 | 
					import org.eclipse.jgit.lib.Config;
 | 
				
			||||||
 | 
					import org.eclipse.jgit.lib.Constants;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.io.IOException;
 | 
					import java.io.IOException;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -173,8 +174,9 @@ class UrlModule extends ServletModule {
 | 
				
			|||||||
        while (name.endsWith("/")) {
 | 
					        while (name.endsWith("/")) {
 | 
				
			||||||
          name = name.substring(0, name.length() - 1);
 | 
					          name = name.substring(0, name.length() - 1);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (name.endsWith(".git")) {
 | 
					        if (name.endsWith(Constants.DOT_GIT_EXT)) {
 | 
				
			||||||
          name = name.substring(0, name.length() - 4);
 | 
					          name = name.substring(0, //
 | 
				
			||||||
 | 
					              name.length() - Constants.DOT_GIT_EXT.length());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        while (name.endsWith("/")) {
 | 
					        while (name.endsWith("/")) {
 | 
				
			||||||
          name = name.substring(0, name.length() - 1);
 | 
					          name = name.substring(0, name.length() - 1);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -103,8 +103,9 @@ public class SubmoduleSectionParser {
 | 
				
			|||||||
            fromIndex = urlExtractedPath.lastIndexOf('/', fromIndex - 1);
 | 
					            fromIndex = urlExtractedPath.lastIndexOf('/', fromIndex - 1);
 | 
				
			||||||
            projectName = urlExtractedPath.substring(fromIndex + 1);
 | 
					            projectName = urlExtractedPath.substring(fromIndex + 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (projectName.endsWith(".git")) {
 | 
					            if (projectName.endsWith(Constants.DOT_GIT_EXT)) {
 | 
				
			||||||
              projectName = projectName.substring(0, projectName.length() - 4);
 | 
					              projectName = projectName.substring(0, //
 | 
				
			||||||
 | 
					                  projectName.length() - Constants.DOT_GIT_EXT.length());
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (repoManager.list().contains(new Project.NameKey(projectName))) {
 | 
					            if (repoManager.list().contains(new Project.NameKey(projectName))) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,6 +27,7 @@ import com.google.gerrit.server.git.GitRepositoryManager;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import org.eclipse.jgit.junit.LocalDiskRepositoryTestCase;
 | 
					import org.eclipse.jgit.junit.LocalDiskRepositoryTestCase;
 | 
				
			||||||
import org.eclipse.jgit.lib.BlobBasedConfig;
 | 
					import org.eclipse.jgit.lib.BlobBasedConfig;
 | 
				
			||||||
 | 
					import org.eclipse.jgit.lib.Constants;
 | 
				
			||||||
import org.junit.Before;
 | 
					import org.junit.Before;
 | 
				
			||||||
import org.junit.Test;
 | 
					import org.junit.Test;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -214,8 +215,9 @@ public class SubmoduleSectionParserTest extends LocalDiskRepositoryTestCase {
 | 
				
			|||||||
        while (fromIndex > 0) {
 | 
					        while (fromIndex > 0) {
 | 
				
			||||||
          fromIndex = urlExtractedPath.lastIndexOf('/', fromIndex - 1);
 | 
					          fromIndex = urlExtractedPath.lastIndexOf('/', fromIndex - 1);
 | 
				
			||||||
          projectNameCandidate = urlExtractedPath.substring(fromIndex + 1);
 | 
					          projectNameCandidate = urlExtractedPath.substring(fromIndex + 1);
 | 
				
			||||||
          if (projectNameCandidate.endsWith(".git")) {
 | 
					          if (projectNameCandidate.endsWith(Constants.DOT_GIT_EXT)) {
 | 
				
			||||||
            projectNameCandidate = projectNameCandidate.substring(0, projectNameCandidate.length() - 4);
 | 
					            projectNameCandidate = projectNameCandidate.substring(0, //
 | 
				
			||||||
 | 
					                projectNameCandidate.length() - Constants.DOT_GIT_EXT.length());
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
          if (projectNameCandidate.equals(reposToBeFound.get(id))) {
 | 
					          if (projectNameCandidate.equals(reposToBeFound.get(id))) {
 | 
				
			||||||
            expect(repoManager.list()).andReturn(
 | 
					            expect(repoManager.list()).andReturn(
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user