Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug#sf1258] http git repo erroneously set to svn #1047

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/org/omegat/core/team2/RemoteRepositoryFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ public static String detectRepositoryType(String url) {
return "svn";
} else if (url.startsWith("git")) {
return "git";
} else if (url.startsWith("https://git")) {
return "git";
} else if (url.endsWith(".git")) {
return "git";
} else {
if (GITRemoteRepository2.isGitRepository(url)) {
return "git";
Expand Down
58 changes: 58 additions & 0 deletions test/src/org/omegat/core/team2/RemoteRepositoryFactoryTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/**************************************************************************
OmegaT - Computer Assisted Translation (CAT) tool
with fuzzy matching, translation memory, keyword search,
glossaries, and translation leveraging into updated projects.

Copyright (C) 2024 Damien Rembert
Home page: https://www.omegat.org/
Support center: https://omegat.org/support

This file is part of OmegaT.

OmegaT is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

OmegaT is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
**************************************************************************/

package org.omegat.core.team2;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

public final class RemoteRepositoryFactoryTest {

@Test
public void testDetectRepositoryType_svnPrefix() {
String url = "svn://example.com/repo";
assertEquals("svn", RemoteRepositoryFactory.detectRepositoryType(url));
}

@Test
public void testDetectRepositoryType_gitPrefix() {
String url = "git://example.com/repo";
assertEquals("git", RemoteRepositoryFactory.detectRepositoryType(url));
}

@Test
public void testDetectRepositoryType_httpsGitPrefix() {
String url = "https://git.example.com/repo";
assertEquals("git", RemoteRepositoryFactory.detectRepositoryType(url));
}

@Test
public void testDetectRepositoryType_gitSuffix() {
String url = "https://example.com/repo.git";
assertEquals("git", RemoteRepositoryFactory.detectRepositoryType(url));
}

}
Loading