mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-09 06:55:47 +01:00
Cleanup Code
Pushed-by: Rene Pfeuffer<rene.pfeuffer@cloudogu.com> Co-authored-by: René Pfeuffer<rene.pfeuffer@cloudogu.com>
This commit is contained in:
@@ -24,7 +24,6 @@
|
||||
|
||||
package org.eclipse.jgit.transport;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.inject.Inject;
|
||||
@@ -43,11 +42,7 @@ import sonia.scm.web.GitReceiveHook;
|
||||
import java.io.File;
|
||||
import java.util.Set;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class ScmTransportProtocol extends TransportProtocol {
|
||||
|
||||
public static final String NAME = "scm";
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
package sonia.scm.repository;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.Lists;
|
||||
@@ -48,11 +47,7 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class GitChangesetConverter implements Closeable {
|
||||
|
||||
private final GPGSignatureResolver gpg;
|
||||
|
||||
@@ -24,8 +24,6 @@
|
||||
|
||||
package sonia.scm.repository;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
@@ -34,9 +32,7 @@ import jakarta.xml.bind.annotation.XmlRootElement;
|
||||
import jakarta.xml.bind.annotation.XmlTransient;
|
||||
import sonia.scm.auditlog.AuditEntry;
|
||||
|
||||
/**
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
|
||||
@XmlRootElement(name = "config")
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@AuditEntry(labels = {"git", "config"})
|
||||
|
||||
@@ -41,7 +41,6 @@ import org.slf4j.LoggerFactory;
|
||||
* Executes git gc on every git repository. Statistics of the gc process are logged to the info level. The task is
|
||||
* disabled by default and must be enabled through the global git configuration.
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
* @since 1.47
|
||||
*/
|
||||
public class GitGcTask implements Runnable {
|
||||
|
||||
@@ -38,7 +38,6 @@ import java.util.Objects;
|
||||
/**
|
||||
* The GitHeadModifier is able to modify the head of a git repository.
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
* @since 1.61
|
||||
*/
|
||||
public class GitHeadModifier {
|
||||
|
||||
@@ -24,63 +24,41 @@
|
||||
|
||||
package sonia.scm.repository;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
import sonia.scm.plugin.Extension;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* Simple {@link HealthCheck} for git repositories.
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
* @since 1.39
|
||||
*/
|
||||
@Extension
|
||||
public final class GitHealthCheck extends DirectoryHealthCheck
|
||||
{
|
||||
|
||||
/** Field description */
|
||||
private static final HealthCheckFailure COULD_NOT_FIND_GIT_DIRECTORIES =
|
||||
new HealthCheckFailure("AKOdhQ0pw1",
|
||||
"Could not find .git or refs directory",
|
||||
"The git repository does not contain a .git or a refs directory.");
|
||||
|
||||
/** Field description */
|
||||
private static final String DIRECTORY_DOT_GIT = ".git";
|
||||
|
||||
/** Field description */
|
||||
private static final String DIRECTORY_REFS = "refs";
|
||||
|
||||
//~--- constructors ---------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
* @param repositoryManager
|
||||
*/
|
||||
|
||||
@Inject
|
||||
public GitHealthCheck(RepositoryManager repositoryManager)
|
||||
{
|
||||
super(repositoryManager);
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param repository
|
||||
* @param directory
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
@Override
|
||||
protected HealthCheckResult check(Repository repository, File directory)
|
||||
{
|
||||
@@ -94,7 +72,6 @@ public final class GitHealthCheck extends DirectoryHealthCheck
|
||||
return result;
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Returns {@code true} if the repository is from type git.
|
||||
|
||||
@@ -24,71 +24,43 @@
|
||||
|
||||
package sonia.scm.repository;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* @author Sebastian Sdorra
|
||||
* @deprecated
|
||||
*/
|
||||
@Deprecated
|
||||
public class GitImportHandler extends AbstactImportHandler {
|
||||
|
||||
/**
|
||||
* Field description
|
||||
*/
|
||||
|
||||
public static final String GIT_DIR = ".git";
|
||||
|
||||
/**
|
||||
* Field description
|
||||
*/
|
||||
|
||||
public static final String GIT_DIR_REFS = "refs";
|
||||
|
||||
/**
|
||||
* the logger for GitImportHandler
|
||||
*/
|
||||
|
||||
private static final Logger logger =
|
||||
LoggerFactory.getLogger(GitImportHandler.class);
|
||||
|
||||
//~--- constructors ---------------------------------------------------------
|
||||
private GitRepositoryHandler handler;
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
* @param handler
|
||||
*/
|
||||
public GitImportHandler(GitRepositoryHandler handler) {
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
@Override
|
||||
protected String[] getDirectoryNames() {
|
||||
return new String[]{GIT_DIR, GIT_DIR_REFS};
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
@Override
|
||||
protected AbstractRepositoryHandler<?> getRepositoryHandler() {
|
||||
return handler;
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Field description
|
||||
*/
|
||||
private GitRepositoryHandler handler;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
package sonia.scm.repository;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.inject.Inject;
|
||||
@@ -44,29 +43,20 @@ import sonia.scm.store.ConfigurationStoreFactory;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
@Singleton
|
||||
@Extension
|
||||
public class GitRepositoryHandler
|
||||
extends AbstractSimpleRepositoryHandler<GitConfig>
|
||||
{
|
||||
|
||||
/** Field description */
|
||||
public static final String DIRECTORY_REFS = "refs";
|
||||
|
||||
/** Field description */
|
||||
public static final String RESOURCE_VERSION =
|
||||
"sonia/scm/version/scm-git-plugin";
|
||||
|
||||
/** Field description */
|
||||
public static final String TYPE_DISPLAYNAME = "Git";
|
||||
|
||||
/** Field description */
|
||||
public static final String TYPE_NAME = "git";
|
||||
|
||||
|
||||
@@ -74,7 +64,6 @@ public class GitRepositoryHandler
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GitRepositoryHandler.class);
|
||||
|
||||
/** Field description */
|
||||
public static final RepositoryType TYPE = new RepositoryType(TYPE_NAME,
|
||||
TYPE_DISPLAYNAME,
|
||||
GitRepositoryServiceProvider.COMMANDS);
|
||||
@@ -87,7 +76,6 @@ public class GitRepositoryHandler
|
||||
|
||||
private Task task;
|
||||
|
||||
//~--- constructors ---------------------------------------------------------
|
||||
|
||||
@Inject
|
||||
public GitRepositoryHandler(ConfigurationStoreFactory storeFactory,
|
||||
@@ -101,7 +89,6 @@ public class GitRepositoryHandler
|
||||
this.workingCopyFactory = workingCopyFactory;
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public void init(SCMContextProvider context)
|
||||
@@ -133,36 +120,21 @@ public class GitRepositoryHandler
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
@Override
|
||||
public ImportHandler getImportHandler()
|
||||
{
|
||||
return new GitImportHandler(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
@Override
|
||||
public RepositoryType getType()
|
||||
{
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
@Override
|
||||
public String getVersionInformation()
|
||||
{
|
||||
@@ -177,7 +149,6 @@ public class GitRepositoryHandler
|
||||
return new GitConfigHelper().getRepositoryId(gitConfig);
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
protected void create(Repository repository, File directory) throws IOException {
|
||||
@@ -196,26 +167,15 @@ public class GitRepositoryHandler
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
@Override
|
||||
protected GitConfig createInitialConfig()
|
||||
{
|
||||
return new GitConfig();
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
@Override
|
||||
protected Class<GitConfig> getConfigClass()
|
||||
{
|
||||
|
||||
@@ -34,7 +34,6 @@ import sonia.scm.plugin.Extension;
|
||||
/**
|
||||
* Repository listener which handles git related repository events.
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
* @since 1.50
|
||||
*/
|
||||
@Extension
|
||||
|
||||
@@ -31,7 +31,6 @@ import sonia.scm.util.Util;
|
||||
/**
|
||||
* Matches git repositories with ".git" and without ".git".
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
* @since 1.54
|
||||
*/
|
||||
@Extension
|
||||
|
||||
@@ -30,9 +30,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
|
||||
public final class GitSubModuleParser {
|
||||
|
||||
private GitSubModuleParser() {
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
package sonia.scm.repository;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.base.Strings;
|
||||
@@ -77,11 +76,7 @@ import static java.util.Optional.empty;
|
||||
import static java.util.Optional.of;
|
||||
import static java.util.Optional.ofNullable;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public final class GitUtil {
|
||||
|
||||
private static final GitUserAgentProvider GIT_USER_AGENT_PROVIDER = new GitUserAgentProvider();
|
||||
@@ -97,18 +92,14 @@ public final class GitUtil {
|
||||
private static final String REMOTE_REF = "refs/remote/scm/%s/%s";
|
||||
private static final int TIMEOUT = 5;
|
||||
|
||||
/**
|
||||
* the logger for GitUtil
|
||||
*/
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GitUtil.class);
|
||||
private static final String REF_SPEC = "refs/heads/*:refs/heads/*";
|
||||
|
||||
//~--- constructors ---------------------------------------------------------
|
||||
|
||||
private GitUtil() {
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
public static void close(org.eclipse.jgit.lib.Repository repo) {
|
||||
if (repo != null) {
|
||||
@@ -118,10 +109,6 @@ public final class GitUtil {
|
||||
|
||||
/**
|
||||
* TODO cache
|
||||
*
|
||||
* @param repository
|
||||
* @param revWalk
|
||||
* @return
|
||||
*/
|
||||
public static Multimap<ObjectId,
|
||||
String> createTagMap(org.eclipse.jgit.lib.Repository repository,
|
||||
@@ -202,7 +189,6 @@ public final class GitUtil {
|
||||
}
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
public static String getBranch(Ref ref) {
|
||||
String branch = null;
|
||||
@@ -256,14 +242,7 @@ public final class GitUtil {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
* @param repo
|
||||
* @param branchName
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
|
||||
public static Ref getBranchId(org.eclipse.jgit.lib.Repository repo,
|
||||
String branchName)
|
||||
throws IOException {
|
||||
@@ -354,12 +333,7 @@ public final class GitUtil {
|
||||
return tag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
* @param commit
|
||||
* @return
|
||||
*/
|
||||
|
||||
public static long getCommitTime(RevCommit commit) {
|
||||
long date = commit.getCommitTime();
|
||||
|
||||
@@ -368,12 +342,7 @@ public final class GitUtil {
|
||||
return date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
* @param objectId
|
||||
* @return
|
||||
*/
|
||||
|
||||
public static String getId(AnyObjectId objectId) {
|
||||
String id = Util.EMPTY_STRING;
|
||||
|
||||
@@ -384,14 +353,7 @@ public final class GitUtil {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
* @param repository
|
||||
* @param id
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
|
||||
public static Ref getRefForCommit(org.eclipse.jgit.lib.Repository repository,
|
||||
ObjectId id)
|
||||
throws IOException {
|
||||
@@ -456,14 +418,7 @@ public final class GitUtil {
|
||||
.findFirst();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
* @param repo
|
||||
* @param revision
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
|
||||
public static ObjectId getRevisionId(org.eclipse.jgit.lib.Repository repo,
|
||||
String revision)
|
||||
throws IOException {
|
||||
@@ -478,25 +433,12 @@ public final class GitUtil {
|
||||
return revId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
* @param repository
|
||||
* @param localBranch
|
||||
* @return
|
||||
*/
|
||||
|
||||
public static String getScmRemoteRefName(Repository repository,
|
||||
Ref localBranch) {
|
||||
return getScmRemoteRefName(repository, localBranch.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
* @param repository
|
||||
* @param localBranch
|
||||
* @return
|
||||
*/
|
||||
public static String getScmRemoteRefName(Repository repository,
|
||||
String localBranch) {
|
||||
String branch = localBranch;
|
||||
@@ -524,12 +466,7 @@ public final class GitUtil {
|
||||
return tagName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
* @param ref
|
||||
* @return
|
||||
*/
|
||||
|
||||
public static String getTagName(Ref ref) {
|
||||
String name = ref.getName();
|
||||
|
||||
@@ -580,33 +517,15 @@ public final class GitUtil {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the request comes from a git client.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @return true if the client is git
|
||||
*/
|
||||
public static boolean isGitClient(HttpServletRequest request) {
|
||||
return GIT_USER_AGENT_PROVIDER.parseUserAgent(request.getHeader(HttpUtil.HEADER_USERAGENT)) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
* @param dir
|
||||
* @return
|
||||
*/
|
||||
|
||||
public static boolean isGitDirectory(File dir) {
|
||||
return isGitDirectory(FS.DETECTED, dir);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
* @param fs
|
||||
* @param dir
|
||||
* @return
|
||||
*/
|
||||
public static boolean isGitDirectory(FS fs, File dir) {
|
||||
//J-
|
||||
return fs.resolve(dir, DIRECTORY_OBJETCS).exists()
|
||||
@@ -615,22 +534,12 @@ public final class GitUtil {
|
||||
//J+
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
* @param ref
|
||||
* @return
|
||||
*/
|
||||
|
||||
public static boolean isHead(String ref) {
|
||||
return ref.startsWith(REF_HEAD_PREFIX);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
|
||||
public static boolean isValidObjectId(ObjectId id) {
|
||||
return (id != null) && !id.equals(ObjectId.zeroId());
|
||||
}
|
||||
@@ -669,15 +578,7 @@ public final class GitUtil {
|
||||
}
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
* @param repo
|
||||
* @param branchName
|
||||
* @throws IOException
|
||||
*/
|
||||
@VisibleForTesting
|
||||
static void checkBranchName(org.eclipse.jgit.lib.Repository repo,
|
||||
String branchName)
|
||||
@@ -698,12 +599,7 @@ public final class GitUtil {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
* @param repository
|
||||
* @return
|
||||
*/
|
||||
|
||||
private static RefSpec createRefSpec(Repository repository) {
|
||||
return new RefSpec(String.format(REFSPEC, repository.getId()));
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
package sonia.scm.repository.api;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
@@ -35,8 +34,6 @@ import org.eclipse.jgit.transport.ReceiveCommand.Type;
|
||||
|
||||
import sonia.scm.repository.GitUtil;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
@@ -45,19 +42,16 @@ import org.slf4j.LoggerFactory;
|
||||
/**
|
||||
* Collects created, modified and deleted git branches during a hook.
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class GitHookBranchProvider implements HookBranchProvider
|
||||
{
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GitHookBranchProvider.class);
|
||||
|
||||
/**
|
||||
* Constructs a new instance.
|
||||
*
|
||||
*
|
||||
* @param commands received git commands
|
||||
*/
|
||||
private final List<String> createdOrModified;
|
||||
|
||||
private final List<String> deletedOrClosed;
|
||||
|
||||
public GitHookBranchProvider(List<ReceiveCommand> commands)
|
||||
{
|
||||
Builder<String> createdOrModifiedBuilder = ImmutableList.builder();
|
||||
@@ -91,7 +85,6 @@ public class GitHookBranchProvider implements HookBranchProvider
|
||||
return type == Type.CREATE || type == Type.UPDATE || type == Type.UPDATE_NONFASTFORWARD;
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public List<String> getCreatedOrModified()
|
||||
@@ -105,9 +98,4 @@ public class GitHookBranchProvider implements HookBranchProvider
|
||||
return deletedOrClosed;
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
private final List<String> createdOrModified;
|
||||
|
||||
private final List<String> deletedOrClosed;
|
||||
}
|
||||
|
||||
@@ -24,50 +24,30 @@
|
||||
|
||||
package sonia.scm.repository.api;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.eclipse.jgit.transport.ReceivePack;
|
||||
|
||||
import sonia.scm.web.GitHooks;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
|
||||
public final class GitHookMessageProvider implements HookMessageProvider
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
* @param receivePack
|
||||
*/
|
||||
private ReceivePack receivePack;
|
||||
|
||||
public GitHookMessageProvider(ReceivePack receivePack)
|
||||
{
|
||||
this.receivePack = receivePack;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param message
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void sendError(String message)
|
||||
{
|
||||
GitHooks.sendPrefixedError(receivePack, message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param message
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void sendMessage(String message)
|
||||
{
|
||||
@@ -76,8 +56,4 @@ public final class GitHookMessageProvider implements HookMessageProvider
|
||||
}
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
private ReceivePack receivePack;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,6 @@ import static sonia.scm.repository.GitUtil.getId;
|
||||
/**
|
||||
* Git provider implementation of {@link HookTagProvider}.
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
* @since 1.50
|
||||
*/
|
||||
public class GitHookTagProvider implements HookTagProvider {
|
||||
@@ -56,11 +55,6 @@ public class GitHookTagProvider implements HookTagProvider {
|
||||
private final List<Tag> createdTags;
|
||||
private final List<Tag> deletedTags;
|
||||
|
||||
/**
|
||||
* Constructs new instance.
|
||||
*
|
||||
* @param commands received commands
|
||||
*/
|
||||
public GitHookTagProvider(List<ReceiveCommand> commands, Repository repository) {
|
||||
ImmutableList.Builder<Tag> createdTagBuilder = ImmutableList.builder();
|
||||
ImmutableList.Builder<Tag> deletedTagBuilder = ImmutableList.builder();
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
package sonia.scm.repository.spi;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
@@ -71,37 +70,22 @@ import static sonia.scm.NotFoundException.notFound;
|
||||
import static sonia.scm.repository.GitUtil.getBranchIdOrCurrentHead;
|
||||
import static sonia.scm.repository.spi.IntegrateChangesFromWorkdirException.forMessage;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
class AbstractGitCommand {
|
||||
|
||||
/**
|
||||
* the logger for AbstractGitCommand
|
||||
*/
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(AbstractGitCommand.class);
|
||||
private static final Collection<RemoteRefUpdate.Status> ACCEPTED_UPDATE_STATUS = asList(OK, UP_TO_DATE, NON_EXISTING);
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
protected GitContext context;
|
||||
|
||||
protected sonia.scm.repository.Repository repository;
|
||||
|
||||
AbstractGitCommand(GitContext context) {
|
||||
this.repository = context.getRepository();
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
Repository open() throws IOException {
|
||||
return context.open();
|
||||
}
|
||||
@@ -311,16 +295,4 @@ class AbstractGitCommand {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Field description
|
||||
*/
|
||||
protected GitContext context;
|
||||
|
||||
/**
|
||||
* Field description
|
||||
*/
|
||||
protected sonia.scm.repository.Repository repository;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
package sonia.scm.repository.spi;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.io.Closeables;
|
||||
@@ -46,55 +45,31 @@ import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public abstract class AbstractGitIncomingOutgoingCommand
|
||||
extends AbstractGitCommand
|
||||
{
|
||||
|
||||
/** Field description */
|
||||
private static final String REMOTE_REF_PREFIX = "refs/remote/scm/%s/";
|
||||
|
||||
private GitRepositoryHandler handler;
|
||||
private final GitChangesetConverterFactory converterFactory;
|
||||
|
||||
AbstractGitIncomingOutgoingCommand(GitContext context, GitRepositoryHandler handler, GitChangesetConverterFactory converterFactory) {
|
||||
super(context);
|
||||
this.handler = handler;
|
||||
this.converterFactory = converterFactory;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param logCommand
|
||||
* @param localId
|
||||
* @param remoteId
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
protected abstract void prepareLogCommand(
|
||||
org.eclipse.jgit.api.LogCommand logCommand, ObjectId localId,
|
||||
ObjectId remoteId)
|
||||
throws IOException;
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param localId
|
||||
* @param remoteId
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
protected abstract boolean retrieveChangesets(ObjectId localId,
|
||||
ObjectId remoteId);
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
protected ChangesetPagingResult getIncomingOrOutgoingChangesets(PagedRemoteCommandRequest request) throws IOException {
|
||||
Repository remoteRepository = request.getRemoteRepository();
|
||||
@@ -192,9 +167,4 @@ public abstract class AbstractGitIncomingOutgoingCommand
|
||||
return ref;
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
private GitRepositoryHandler handler;
|
||||
private final GitChangesetConverterFactory converterFactory;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
package sonia.scm.repository.spi;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.base.Strings;
|
||||
@@ -49,22 +48,14 @@ import java.util.List;
|
||||
|
||||
import static sonia.scm.ContextEntry.ContextBuilder.entity;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class GitBlameCommand extends AbstractGitCommand implements BlameCommand
|
||||
{
|
||||
|
||||
/**
|
||||
* the logger for GitBlameCommand
|
||||
*/
|
||||
|
||||
private static final Logger logger =
|
||||
LoggerFactory.getLogger(GitBlameCommand.class);
|
||||
|
||||
//~--- constructors ---------------------------------------------------------
|
||||
|
||||
@Inject
|
||||
public GitBlameCommand(@Assisted GitContext context)
|
||||
@@ -72,7 +63,6 @@ public class GitBlameCommand extends AbstractGitCommand implements BlameCommand
|
||||
super(context);
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public BlameResult getBlameResult(BlameCommandRequest request)
|
||||
|
||||
@@ -76,25 +76,16 @@ import static sonia.scm.ContextEntry.ContextBuilder.entity;
|
||||
import static sonia.scm.NotFoundException.notFound;
|
||||
import static sonia.scm.repository.spi.SyncAsyncExecutor.ExecutionType.ASYNCHRONOUS;
|
||||
|
||||
/**
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
|
||||
public class GitBrowseCommand extends AbstractGitCommand
|
||||
implements BrowseCommand {
|
||||
|
||||
/**
|
||||
* Field description
|
||||
*/
|
||||
|
||||
public static final String PATH_MODULES = ".gitmodules";
|
||||
|
||||
/**
|
||||
* the logger for GitBrowseCommand
|
||||
*/
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GitBrowseCommand.class);
|
||||
|
||||
/**
|
||||
* sub repository cache
|
||||
*/
|
||||
private final Map<ObjectId, Map<String, SubRepository>> subrepositoryCache = Maps.newHashMap();
|
||||
|
||||
private final Object asyncMonitor = new Object();
|
||||
|
||||
@@ -38,19 +38,19 @@ import java.io.Closeable;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
|
||||
public class GitContext implements Closeable, RepositoryProvider
|
||||
{
|
||||
|
||||
/**
|
||||
* the logger for GitContext
|
||||
*/
|
||||
private static final Logger logger =
|
||||
LoggerFactory.getLogger(GitContext.class);
|
||||
|
||||
private final File directory;
|
||||
private final Repository repository;
|
||||
private final GitRepositoryConfigStoreProvider storeProvider;
|
||||
private final GitConfig config;
|
||||
|
||||
private org.eclipse.jgit.lib.Repository gitRepository;
|
||||
|
||||
public GitContext(File directory, Repository repository, GitRepositoryConfigStoreProvider storeProvider, GitConfig config)
|
||||
{
|
||||
this.directory = directory;
|
||||
@@ -59,13 +59,8 @@ public class GitContext implements Closeable, RepositoryProvider
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
@Override
|
||||
public void close()
|
||||
{
|
||||
logger.trace("close git repository {}", directory);
|
||||
@@ -74,14 +69,7 @@ public class GitContext implements Closeable, RepositoryProvider
|
||||
gitRepository = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
|
||||
public org.eclipse.jgit.lib.Repository open() throws IOException
|
||||
{
|
||||
if (gitRepository == null)
|
||||
@@ -129,14 +117,4 @@ public class GitContext implements Closeable, RepositoryProvider
|
||||
return config;
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
private final File directory;
|
||||
private final Repository repository;
|
||||
private final GitRepositoryConfigStoreProvider storeProvider;
|
||||
private final GitConfig config;
|
||||
|
||||
/** Field description */
|
||||
private org.eclipse.jgit.lib.Repository gitRepository;
|
||||
}
|
||||
|
||||
@@ -38,9 +38,7 @@ import java.io.OutputStream;
|
||||
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
|
||||
/**
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
|
||||
public class GitDiffCommand extends AbstractGitCommand implements DiffCommand {
|
||||
|
||||
@Inject
|
||||
|
||||
@@ -46,9 +46,7 @@ import java.util.Map;
|
||||
|
||||
import static java.util.Collections.unmodifiableCollection;
|
||||
|
||||
/**
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
|
||||
class GitHookChangesetCollector {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(GitHookChangesetCollector.class);
|
||||
|
||||
@@ -31,10 +31,7 @@ import sonia.scm.repository.api.HookChangesetProvider;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
|
||||
public class GitHookChangesetProvider implements HookChangesetProvider {
|
||||
|
||||
private final GitChangesetConverterFactory converterFactory;
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
package sonia.scm.repository.spi;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.eclipse.jgit.lib.Repository;
|
||||
import org.eclipse.jgit.transport.ReceiveCommand;
|
||||
@@ -46,16 +45,11 @@ import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
|
||||
public class GitHookContextProvider extends HookContextProvider
|
||||
{
|
||||
|
||||
/**
|
||||
* Field description
|
||||
*/
|
||||
|
||||
private static final Set<HookFeature> SUPPORTED_FEATURES = EnumSet.of(
|
||||
HookFeature.MESSAGE_PROVIDER,
|
||||
HookFeature.CHANGESET_PROVIDER,
|
||||
@@ -65,15 +59,9 @@ public class GitHookContextProvider extends HookContextProvider
|
||||
HookFeature.MERGE_DETECTION_PROVIDER
|
||||
);
|
||||
|
||||
//~--- constructors ---------------------------------------------------------
|
||||
|
||||
private final GitChangesetConverterFactory converterFactory;
|
||||
|
||||
/**
|
||||
* Constructs a new instance
|
||||
* @param receivePack git receive pack
|
||||
* @param receiveCommands received commands
|
||||
*/
|
||||
public GitHookContextProvider(
|
||||
GitChangesetConverterFactory converterFactory, ReceivePack receivePack,
|
||||
List<ReceiveCommand> receiveCommands,
|
||||
@@ -89,7 +77,6 @@ public class GitHookContextProvider extends HookContextProvider
|
||||
this.converterFactory = converterFactory;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public HookMessageProvider createMessageProvider()
|
||||
@@ -97,7 +84,6 @@ public class GitHookContextProvider extends HookContextProvider
|
||||
return new GitHookMessageProvider(receivePack);
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public HookBranchProvider getBranchProvider()
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
package sonia.scm.repository.spi;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
import jakarta.inject.Inject;
|
||||
@@ -36,12 +35,7 @@ import sonia.scm.repository.GitRepositoryHandler;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class GitIncomingCommand extends AbstractGitIncomingOutgoingCommand
|
||||
implements IncomingCommand {
|
||||
|
||||
@@ -50,25 +44,12 @@ public class GitIncomingCommand extends AbstractGitIncomingOutgoingCommand
|
||||
super(context, handler, converterFactory);
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public ChangesetPagingResult getIncomingChangesets(IncomingCommandRequest request) throws IOException {
|
||||
return getIncomingOrOutgoingChangesets(request);
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param logCommand
|
||||
* @param localId
|
||||
* @param remoteId
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
@Override
|
||||
protected void prepareLogCommand(LogCommand logCommand, ObjectId localId,
|
||||
ObjectId remoteId)
|
||||
@@ -82,15 +63,7 @@ public class GitIncomingCommand extends AbstractGitIncomingOutgoingCommand
|
||||
logCommand.add(remoteId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param localId
|
||||
* @param remoteId
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
@Override
|
||||
protected boolean retrieveChangesets(ObjectId localId, ObjectId remoteId)
|
||||
{
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
package sonia.scm.repository.spi;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
@@ -48,32 +47,17 @@ import java.io.IOException;
|
||||
import static sonia.scm.ContextEntry.ContextBuilder.entity;
|
||||
import static sonia.scm.NotFoundException.notFound;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class GitLogCommand extends AbstractGitCommand implements LogCommand
|
||||
{
|
||||
|
||||
/**
|
||||
* the logger for GitLogCommand
|
||||
*/
|
||||
|
||||
private static final Logger logger =
|
||||
LoggerFactory.getLogger(GitLogCommand.class);
|
||||
public static final String REVISION = "Revision";
|
||||
private final GitChangesetConverterFactory converterFactory;
|
||||
|
||||
//~--- constructors ---------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
* @param context
|
||||
*
|
||||
*/
|
||||
@Inject
|
||||
GitLogCommand(@Assisted GitContext context, GitChangesetConverterFactory converterFactory)
|
||||
{
|
||||
@@ -81,16 +65,8 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand
|
||||
this.converterFactory = converterFactory;
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param revision
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("java:S2093")
|
||||
public Changeset getChangeset(String revision, LogCommandRequest request)
|
||||
@@ -166,16 +142,7 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand
|
||||
return revWalk.parseCommit(GitUtil.getCommit(repository, revWalk, repository.findRef(branchName)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param request
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("java:S2093")
|
||||
public ChangesetPagingResult getChangesets(LogCommandRequest request) {
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
package sonia.scm.repository.spi;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
import jakarta.inject.Inject;
|
||||
@@ -36,12 +35,7 @@ import sonia.scm.repository.GitRepositoryHandler;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class GitOutgoingCommand extends AbstractGitIncomingOutgoingCommand
|
||||
implements OutgoingCommand {
|
||||
|
||||
@@ -51,18 +45,8 @@ public class GitOutgoingCommand extends AbstractGitIncomingOutgoingCommand
|
||||
super(context, handler, converterFactory);
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param request
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
|
||||
@Override
|
||||
public ChangesetPagingResult getOutgoingChangesets(
|
||||
OutgoingCommandRequest request)
|
||||
@@ -71,18 +55,6 @@ public class GitOutgoingCommand extends AbstractGitIncomingOutgoingCommand
|
||||
return getIncomingOrOutgoingChangesets(request);
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param logCommand
|
||||
* @param localId
|
||||
* @param remoteId
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
@Override
|
||||
protected void prepareLogCommand(LogCommand logCommand, ObjectId localId,
|
||||
ObjectId remoteId)
|
||||
@@ -96,15 +68,7 @@ public class GitOutgoingCommand extends AbstractGitIncomingOutgoingCommand
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param localId
|
||||
* @param remoteId
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
@Override
|
||||
protected boolean retrieveChangesets(ObjectId localId, ObjectId remoteId)
|
||||
{
|
||||
|
||||
@@ -52,9 +52,7 @@ import sonia.scm.repository.api.PullResponse;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
|
||||
public class GitPullCommand extends AbstractGitPushOrPullCommand
|
||||
implements PullCommand {
|
||||
|
||||
|
||||
@@ -32,9 +32,7 @@ import sonia.scm.repository.api.Command;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
|
||||
public class GitRepositoryServiceProvider extends RepositoryServiceProvider {
|
||||
|
||||
public static final Set<Command> COMMANDS = ImmutableSet.of(
|
||||
@@ -71,7 +69,6 @@ public class GitRepositoryServiceProvider extends RepositoryServiceProvider {
|
||||
private final Injector injector;
|
||||
private final GitContext context;
|
||||
|
||||
//~--- constructors ---------------------------------------------------------
|
||||
|
||||
GitRepositoryServiceProvider(Injector injector, GitContext context) {
|
||||
this.injector = injector;
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
package sonia.scm.repository.spi;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Injector;
|
||||
@@ -32,10 +31,7 @@ import sonia.scm.plugin.Extension;
|
||||
import sonia.scm.repository.GitRepositoryHandler;
|
||||
import sonia.scm.repository.Repository;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
|
||||
@Extension
|
||||
public class GitRepositoryServiceResolver implements RepositoryServiceResolver {
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
package sonia.scm.repository.spi;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
import jakarta.inject.Inject;
|
||||
@@ -40,27 +39,18 @@ import java.util.List;
|
||||
|
||||
import static java.util.stream.Collectors.toList;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class GitTagsCommand extends AbstractGitCommand implements TagsCommand {
|
||||
|
||||
private final GitTagConverter gitTagConverter;
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
|
||||
@Inject
|
||||
public GitTagsCommand(@Assisted GitContext context, GitTagConverter gitTagConverter) {
|
||||
super(context);
|
||||
this.gitTagConverter = gitTagConverter;
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public List<Tag> getTags() throws IOException {
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
package sonia.scm.web;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
@@ -39,8 +38,6 @@ import org.eclipse.jgit.transport.PackParser;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
@@ -48,23 +45,20 @@ import java.util.Set;
|
||||
* pushed with the reveive pack. The listener is used to find out which object
|
||||
* is new and which was already pushed.
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class CollectingPackParserListener implements PackParserListener
|
||||
{
|
||||
|
||||
/**
|
||||
* the logger for CollectingPackParserListener
|
||||
*/
|
||||
private static final Logger logger =
|
||||
LoggerFactory.getLogger(CollectingPackParserListener.class);
|
||||
private final GitReceiveHook hook;
|
||||
|
||||
private Set<ObjectId> newObjectIds;
|
||||
|
||||
public CollectingPackParserListener(GitReceiveHook hook) {
|
||||
this.hook = hook;
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Returns the listener from the receive pack.
|
||||
@@ -91,7 +85,6 @@ public class CollectingPackParserListener implements PackParserListener
|
||||
return (CollectingPackParserListener) listener;
|
||||
}
|
||||
|
||||
//~--- set methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Applies the listener to the receive pack.
|
||||
@@ -105,7 +98,6 @@ public class CollectingPackParserListener implements PackParserListener
|
||||
pack.setPackParserListener(new CollectingPackParserListener(hook));
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Collects all new object ids.
|
||||
@@ -134,9 +126,6 @@ public class CollectingPackParserListener implements PackParserListener
|
||||
|
||||
/**
|
||||
* Prepares the pack parser to retrieve the new object ids.
|
||||
*
|
||||
*
|
||||
* @param parser pack parser
|
||||
*/
|
||||
@Override
|
||||
public void before(PackParser parser)
|
||||
@@ -150,14 +139,9 @@ public class CollectingPackParserListener implements PackParserListener
|
||||
hook.afterReceive();
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Returns {@code true} if the object is a new object.
|
||||
*
|
||||
* @param object rev object
|
||||
*
|
||||
* @return {@code true} if the object is new
|
||||
*/
|
||||
public boolean isNew(RevObject object)
|
||||
{
|
||||
@@ -166,7 +150,6 @@ public class CollectingPackParserListener implements PackParserListener
|
||||
return newObjectIds.contains(object.getId());
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Throws an {@link IllegalStateException} if the after method was not called.
|
||||
@@ -180,8 +163,4 @@ public class CollectingPackParserListener implements PackParserListener
|
||||
}
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** set of new object ids */
|
||||
private Set<ObjectId> newObjectIds;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
package sonia.scm.web;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import jakarta.servlet.ServletContextEvent;
|
||||
@@ -35,42 +34,23 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import sonia.scm.plugin.Extension;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
|
||||
@Extension
|
||||
public class GitContextListener implements ServletContextListener
|
||||
{
|
||||
|
||||
/**
|
||||
* the logger for GitContextListener
|
||||
*/
|
||||
private static final Logger logger =
|
||||
LoggerFactory.getLogger(GitContextListener.class);
|
||||
|
||||
//~--- constructors ---------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
* @param transportProtocol
|
||||
*/
|
||||
private ScmTransportProtocol transportProtocol;
|
||||
|
||||
@Inject
|
||||
public GitContextListener(ScmTransportProtocol transportProtocol)
|
||||
{
|
||||
this.transportProtocol = transportProtocol;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param sce
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void contextDestroyed(ServletContextEvent sce)
|
||||
{
|
||||
@@ -78,12 +58,7 @@ public class GitContextListener implements ServletContextListener
|
||||
// do nothing
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param sce
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void contextInitialized(ServletContextEvent sce)
|
||||
{
|
||||
@@ -91,8 +66,4 @@ public class GitContextListener implements ServletContextListener
|
||||
Transport.register(transportProtocol);
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
private ScmTransportProtocol transportProtocol;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
package sonia.scm.web;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.common.base.Stopwatch;
|
||||
import com.google.common.io.Closer;
|
||||
@@ -39,49 +38,32 @@ import sonia.scm.repository.GitUtil;
|
||||
import sonia.scm.repository.RepositoryHookType;
|
||||
import sonia.scm.util.IOUtil;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
|
||||
public class GitFileHook
|
||||
{
|
||||
|
||||
/** Field description */
|
||||
public static final String FILE_HOOKDIRECTORY = "hooks";
|
||||
|
||||
/** Field description */
|
||||
public static final String FILE_HOOK_POST_RECEIVE = "post-receive";
|
||||
|
||||
/** Field description */
|
||||
public static final String FILE_HOOK_PRE_RECEIVE = "pre-receive";
|
||||
|
||||
/**
|
||||
* the logger for GitFileHook
|
||||
*/
|
||||
|
||||
private static final Logger logger =
|
||||
LoggerFactory.getLogger(GitFileHook.class);
|
||||
|
||||
//~--- constructors ---------------------------------------------------------
|
||||
private final Iterable<ReceiveCommand> commands;
|
||||
|
||||
private final ReceivePack rpack;
|
||||
|
||||
private final RepositoryHookType type;
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param executor
|
||||
* @param type
|
||||
* @param rpack
|
||||
* @param commands
|
||||
*/
|
||||
private GitFileHook(RepositoryHookType type, ReceivePack rpack,
|
||||
Iterable<ReceiveCommand> commands)
|
||||
{
|
||||
@@ -90,33 +72,13 @@ public class GitFileHook
|
||||
this.commands = commands;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param type
|
||||
* @param rpack
|
||||
* @param commands
|
||||
*/
|
||||
public static void execute(RepositoryHookType type, ReceivePack rpack,
|
||||
Iterable<ReceiveCommand> commands)
|
||||
{
|
||||
new GitFileHook(type, rpack, commands).execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param hook
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
|
||||
private Process createProcess(File hook) throws IOException
|
||||
{
|
||||
ProcessBuilder pb = new ProcessBuilder(hook.getAbsolutePath());
|
||||
@@ -132,14 +94,7 @@ public class GitFileHook
|
||||
return pb.redirectErrorStream(true).start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param rc
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
private String createReceiveCommandOutput(ReceiveCommand rc)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
@@ -153,12 +108,7 @@ public class GitFileHook
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param type
|
||||
*/
|
||||
|
||||
private void execute()
|
||||
{
|
||||
File hook = getHookFile();
|
||||
@@ -189,12 +139,7 @@ public class GitFileHook
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param hook
|
||||
*/
|
||||
|
||||
private void execute(File hook)
|
||||
{
|
||||
Process p;
|
||||
@@ -254,16 +199,8 @@ public class GitFileHook
|
||||
}
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param type
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
private File getHookFile()
|
||||
{
|
||||
File hook = null;
|
||||
@@ -287,15 +224,7 @@ public class GitFileHook
|
||||
return hook;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param directory
|
||||
* @param name
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
private File getHookFile(File directory, String name)
|
||||
{
|
||||
//J-
|
||||
@@ -308,14 +237,4 @@ public class GitFileHook
|
||||
//J+
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
private final Iterable<ReceiveCommand> commands;
|
||||
|
||||
/** Field description */
|
||||
private final ReceivePack rpack;
|
||||
|
||||
/** Field description */
|
||||
private final RepositoryHookType type;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
package sonia.scm.web;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.Lists;
|
||||
@@ -37,50 +36,23 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import sonia.scm.repository.RepositoryHookType;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
|
||||
public final class GitHooks
|
||||
{
|
||||
|
||||
/** Field description */
|
||||
public static final String PREFIX_MSG = "[SCM] ";
|
||||
|
||||
/**
|
||||
* the logger for GitHooks
|
||||
*/
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GitHooks.class);
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param type
|
||||
* @param rpack
|
||||
* @param commands
|
||||
*/
|
||||
public static void abortIfPossible(RepositoryHookType type,
|
||||
ReceivePack rpack, Iterable<ReceiveCommand> commands)
|
||||
{
|
||||
abortIfPossible(type, rpack, commands, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param type
|
||||
* @param rpack
|
||||
* @param commands
|
||||
* @param message
|
||||
*/
|
||||
public static void abortIfPossible(RepositoryHookType type,
|
||||
ReceivePack rpack, Iterable<ReceiveCommand> commands, String message)
|
||||
{
|
||||
@@ -98,15 +70,7 @@ public final class GitHooks
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param type
|
||||
* @param commands
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
public static List<ReceiveCommand> filterReceiveable(RepositoryHookType type,
|
||||
Iterable<ReceiveCommand> commands)
|
||||
{
|
||||
@@ -128,54 +92,26 @@ public final class GitHooks
|
||||
return receiveable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param rpack
|
||||
* @param message
|
||||
*/
|
||||
|
||||
public static void sendPrefixedError(ReceivePack rpack, String message)
|
||||
{
|
||||
rpack.sendError(createPrefixedMessage(message));
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param rpack
|
||||
* @param message
|
||||
*/
|
||||
|
||||
public static void sendPrefixedMessage(ReceivePack rpack, String message)
|
||||
{
|
||||
rpack.sendMessage(createPrefixedMessage(message));
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param message
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
private static String createPrefixedMessage(String message)
|
||||
{
|
||||
return PREFIX_MSG.concat(Strings.nullToEmpty(message));
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param rc
|
||||
* @param type
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
private static boolean isReceiveable(RepositoryHookType type,
|
||||
ReceiveCommand rc)
|
||||
{
|
||||
|
||||
@@ -39,7 +39,6 @@ import java.io.IOException;
|
||||
/**
|
||||
* GitPermissionFilter decides if a git request requires write or read privileges.
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class GitPermissionFilter extends PermissionFilter
|
||||
{
|
||||
@@ -54,7 +53,6 @@ public class GitPermissionFilter extends PermissionFilter
|
||||
|
||||
private static final String METHOD_LFS_UPLOAD = "PUT";
|
||||
|
||||
//~--- constructors ---------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Constructs a new instance of the GitPermissionFilter.
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
package sonia.scm.web;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.eclipse.jgit.lib.Repository;
|
||||
import org.eclipse.jgit.lib.StoredConfig;
|
||||
@@ -44,12 +43,7 @@ import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class GitReceiveHook implements PreReceiveHook, PostReceiveHook {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(GitReceiveHook.class);
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
package sonia.scm.web;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
@@ -40,13 +39,10 @@ import sonia.scm.repository.GitChangesetConverterFactory;
|
||||
import sonia.scm.repository.GitRepositoryHandler;
|
||||
import sonia.scm.repository.spi.HookEventFacade;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* GitReceivePackFactory creates {@link ReceivePack} objects and assigns the required
|
||||
* Hook components.
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class GitReceivePackFactory extends BaseReceivePackFactory<HttpServletRequest>
|
||||
{
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
package sonia.scm.web;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.inject.Inject;
|
||||
@@ -43,19 +42,13 @@ import sonia.scm.repository.RepositoryProvider;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class GitRepositoryResolver implements RepositoryResolver<HttpServletRequest>
|
||||
{
|
||||
|
||||
/** the logger for GitRepositoryResolver */
|
||||
private static final Logger logger = LoggerFactory.getLogger(GitRepositoryResolver.class);
|
||||
|
||||
//~--- constructors ---------------------------------------------------------
|
||||
private final GitRepositoryHandler handler;
|
||||
private final RepositoryProvider repositoryProvider;
|
||||
|
||||
@Inject
|
||||
public GitRepositoryResolver(GitRepositoryHandler handler, RepositoryProvider repositoryProvider)
|
||||
@@ -64,19 +57,10 @@ public class GitRepositoryResolver implements RepositoryResolver<HttpServletRequ
|
||||
this.repositoryProvider = repositoryProvider;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param request http request
|
||||
* @param repositoryName repository name
|
||||
*
|
||||
* @return jgit repository
|
||||
*
|
||||
* @throws RepositoryNotFoundException
|
||||
* @throws ServiceNotEnabledException
|
||||
*/
|
||||
@Override
|
||||
public Repository open(HttpServletRequest request, String repositoryName) throws RepositoryNotFoundException, ServiceNotEnabledException
|
||||
@@ -118,8 +102,4 @@ public class GitRepositoryResolver implements RepositoryResolver<HttpServletRequ
|
||||
}
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
private final GitRepositoryHandler handler;
|
||||
private final RepositoryProvider repositoryProvider;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
package sonia.scm.web;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
@@ -55,40 +54,25 @@ import java.io.Writer;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class GitRepositoryViewer
|
||||
{
|
||||
|
||||
/** Field description */
|
||||
public static final String MIMETYPE_HTML = "text/html";
|
||||
|
||||
/** Field description */
|
||||
public static final String RESOURCE_GITINDEX =
|
||||
"/sonia/scm/git.index.mustache";
|
||||
|
||||
/** Field description */
|
||||
private static final int CHANGESET_PER_BRANCH = 10;
|
||||
|
||||
/**
|
||||
* the logger for GitRepositoryViewer
|
||||
*/
|
||||
|
||||
private static final Logger logger =
|
||||
LoggerFactory.getLogger(GitRepositoryViewer.class);
|
||||
|
||||
//~--- constructors ---------------------------------------------------------
|
||||
private final RepositoryServiceFactory repositoryServiceFactory;
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
* @param templateEngineFactory
|
||||
* @param repositoryServiceFactory
|
||||
*/
|
||||
private final TemplateEngineFactory templateEngineFactory;
|
||||
|
||||
@Inject
|
||||
public GitRepositoryViewer(TemplateEngineFactory templateEngineFactory,
|
||||
RepositoryServiceFactory repositoryServiceFactory)
|
||||
@@ -97,7 +81,6 @@ public class GitRepositoryViewer
|
||||
this.repositoryServiceFactory = repositoryServiceFactory;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
public void handleRequest(HttpServletRequest request,
|
||||
HttpServletResponse response, Repository repository)
|
||||
@@ -133,16 +116,7 @@ public class GitRepositoryViewer
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param repository
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
|
||||
private BranchesModel createBranchesModel(Repository repository)
|
||||
throws IOException
|
||||
{
|
||||
@@ -167,97 +141,53 @@ public class GitRepositoryViewer
|
||||
return model;
|
||||
}
|
||||
|
||||
//~--- inner classes --------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Class description
|
||||
*
|
||||
*
|
||||
* @version Enter version here..., 13/02/27
|
||||
* @author Enter your name here...
|
||||
*/
|
||||
|
||||
|
||||
private static class BranchModel
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
* @param name
|
||||
* @param changesets
|
||||
*/
|
||||
private final Iterable<ChangesetModel> changesets;
|
||||
|
||||
private final String name;
|
||||
|
||||
public BranchModel(String name, Iterable<ChangesetModel> changesets)
|
||||
{
|
||||
this.name = name;
|
||||
this.changesets = changesets;
|
||||
}
|
||||
|
||||
//~--- get methods --------------------------------------------------------
|
||||
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
public Iterable<ChangesetModel> getChangesets()
|
||||
{
|
||||
return changesets;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
//~--- fields -------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
private final Iterable<ChangesetModel> changesets;
|
||||
|
||||
/** Field description */
|
||||
private final String name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Class description
|
||||
*
|
||||
*
|
||||
* @version Enter version here..., 13/02/27
|
||||
* @author Enter your name here...
|
||||
*/
|
||||
|
||||
private static class BranchModelTransformer
|
||||
implements Function<Branch, BranchModel>
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
* @param service
|
||||
*/
|
||||
private final RepositoryService service;
|
||||
|
||||
public BranchModelTransformer(RepositoryService service)
|
||||
{
|
||||
this.service = service;
|
||||
}
|
||||
|
||||
//~--- methods ------------------------------------------------------------
|
||||
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param branch
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
@Override
|
||||
public BranchModel apply(Branch branch)
|
||||
{
|
||||
@@ -294,95 +224,49 @@ public class GitRepositoryViewer
|
||||
return model;
|
||||
}
|
||||
|
||||
//~--- fields -------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
private final RepositoryService service;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Class description
|
||||
*
|
||||
*
|
||||
* @version Enter version here..., 13/02/27
|
||||
* @author Enter your name here...
|
||||
*/
|
||||
|
||||
private static class BranchesModel implements Iterable<BranchModel>
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
* @param branches
|
||||
*/
|
||||
private final Iterable<BranchModel> branches;
|
||||
|
||||
public BranchesModel(Iterable<BranchModel> branches)
|
||||
{
|
||||
this.branches = branches;
|
||||
}
|
||||
|
||||
//~--- methods ------------------------------------------------------------
|
||||
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
@Override
|
||||
public Iterator<BranchModel> iterator()
|
||||
{
|
||||
return branches.iterator();
|
||||
}
|
||||
|
||||
//~--- fields -------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
private final Iterable<BranchModel> branches;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Class description
|
||||
*
|
||||
*
|
||||
* @version Enter version here..., 13/02/27
|
||||
* @author Enter your name here...
|
||||
*/
|
||||
|
||||
private static class ChangesetModel
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
* @param changeset
|
||||
*/
|
||||
private final Changeset changeset;
|
||||
|
||||
public ChangesetModel(Changeset changeset)
|
||||
{
|
||||
this.changeset = changeset;
|
||||
}
|
||||
|
||||
//~--- get methods --------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Person getAuthor()
|
||||
{
|
||||
return changeset.getAuthor();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
public String getDate()
|
||||
{
|
||||
String date = Util.EMPTY_STRING;
|
||||
@@ -396,29 +280,12 @@ public class GitRepositoryViewer
|
||||
return date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return changeset.getDescription();
|
||||
}
|
||||
|
||||
//~--- fields -------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
private final Changeset changeset;
|
||||
}
|
||||
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
private final RepositoryServiceFactory repositoryServiceFactory;
|
||||
|
||||
/** Field description */
|
||||
private final TemplateEngineFactory templateEngineFactory;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
package sonia.scm.web;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.inject.assistedinject.FactoryModuleBuilder;
|
||||
import com.google.inject.servlet.ServletModule;
|
||||
@@ -85,9 +84,7 @@ import sonia.scm.repository.spi.TagsCommand;
|
||||
import sonia.scm.repository.spi.UnbundleCommand;
|
||||
import sonia.scm.web.lfs.LfsBlobStoreFactory;
|
||||
|
||||
/**
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
|
||||
@Extension
|
||||
public class GitServletModule extends ServletModule {
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
package sonia.scm.web;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.base.Charsets;
|
||||
@@ -35,7 +34,6 @@ import sonia.scm.plugin.Extension;
|
||||
|
||||
/**
|
||||
* UserAgent provider for git related clients.
|
||||
* @author Sebastian Sdorra <sebastian.sdorra@gmail.com>
|
||||
* @since 1.45
|
||||
*/
|
||||
@Extension
|
||||
@@ -71,7 +69,6 @@ public class GitUserAgentProvider implements UserAgentProvider {
|
||||
|
||||
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public UserAgent parseUserAgent(String userAgentString) {
|
||||
|
||||
@@ -47,10 +47,7 @@ import java.util.regex.Pattern;
|
||||
import static org.eclipse.jgit.lfs.lib.Constants.CONTENT_TYPE_GIT_LFS_JSON;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
|
||||
@Singleton
|
||||
public class ScmGitServlet extends GitServlet implements ScmProviderHttpServlet
|
||||
{
|
||||
@@ -61,14 +58,18 @@ public class ScmGitServlet extends GitServlet implements ScmProviderHttpServlet
|
||||
"(?x)^/repo/(.*/(HEAD|info/refs|objects/(info/[^/]+|[0-9a-f]{2}/[0-9a-f]{38}|pack/pack-[0-9a-f]{40}\\.(pack|idx))|git-(upload|receive)-pack))$"
|
||||
);
|
||||
|
||||
/** Field description */
|
||||
private static final long serialVersionUID = -7712897339207470674L;
|
||||
|
||||
/** the logger for ScmGitServlet */
|
||||
|
||||
private static final Logger logger = getLogger(ScmGitServlet.class);
|
||||
public static final MediaType LFS_LOCKING_MEDIA_TYPE = MediaType.valueOf("application/vnd.git-lfs+json");
|
||||
|
||||
//~--- constructors ---------------------------------------------------------
|
||||
private final RepositoryRequestListenerUtil repositoryRequestListenerUtil;
|
||||
|
||||
|
||||
private final GitRepositoryViewer repositoryViewer;
|
||||
|
||||
private final LfsServletFactory lfsServletFactory;
|
||||
|
||||
@Inject
|
||||
public ScmGitServlet(GitRepositoryResolver repositoryResolver,
|
||||
@@ -85,18 +86,7 @@ public class ScmGitServlet extends GitServlet implements ScmProviderHttpServlet
|
||||
setReceivePackFactory(receivePackFactory);
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws ServletException
|
||||
*/
|
||||
@Override
|
||||
public void service(HttpServletRequest request, HttpServletResponse response, Repository repository)
|
||||
throws ServletException, IOException
|
||||
@@ -253,15 +243,4 @@ public class ScmGitServlet extends GitServlet implements ScmProviderHttpServlet
|
||||
return false;
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
private final RepositoryRequestListenerUtil repositoryRequestListenerUtil;
|
||||
|
||||
/**
|
||||
* Field description
|
||||
*/
|
||||
private final GitRepositoryViewer repositoryViewer;
|
||||
|
||||
private final LfsServletFactory lfsServletFactory;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ import sonia.scm.store.BlobStoreFactory;
|
||||
/**
|
||||
* Creates {@link BlobStore} objects to store lfs objects.
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
* @since 1.54
|
||||
*/
|
||||
@Singleton
|
||||
@@ -43,11 +42,6 @@ public class LfsBlobStoreFactory {
|
||||
|
||||
private final BlobStoreFactory blobStoreFactory;
|
||||
|
||||
/**
|
||||
* Create a new instance.
|
||||
*
|
||||
* @param blobStoreFactory blob store factory
|
||||
*/
|
||||
@Inject
|
||||
public LfsBlobStoreFactory(BlobStoreFactory blobStoreFactory) {
|
||||
this.blobStoreFactory = blobStoreFactory;
|
||||
|
||||
@@ -40,9 +40,7 @@ import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
/**
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
|
||||
@RunWith(MockitoJUnitRunner.Silent.class)
|
||||
public class GitRepositoryHandlerTest extends SimpleRepositoryHandlerTestBase {
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@ import static org.junit.Assert.assertTrue;
|
||||
/**
|
||||
* Unit tests for {@link GitRepositoryPathMatcher}.
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
* @since 1.54
|
||||
*/
|
||||
public class GitRepositoryPathMatcherTest {
|
||||
|
||||
@@ -24,38 +24,25 @@
|
||||
|
||||
package sonia.scm.repository;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
|
||||
public class GitSubModuleParserTest
|
||||
{
|
||||
|
||||
/** Field description */
|
||||
public static final String GITMODULES_001 =
|
||||
"/sonia/scm/repository/gitmodules-001";
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
|
||||
@Test
|
||||
public void testParse() throws IOException
|
||||
{
|
||||
@@ -74,18 +61,8 @@ public class GitSubModuleParserTest
|
||||
repository.getRepositoryUrl());
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param resource
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
|
||||
private String getContent(String resource) throws IOException
|
||||
{
|
||||
InputStream input =
|
||||
@@ -97,16 +74,7 @@ public class GitSubModuleParserTest
|
||||
return new String(buffer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param resource
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
|
||||
private Map<String, SubRepository> getSubRepositories(String resource)
|
||||
throws IOException
|
||||
{
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
package sonia.scm.repository;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import org.assertj.core.api.Assertions;
|
||||
@@ -54,7 +53,6 @@ import static org.mockito.Mockito.when;
|
||||
/**
|
||||
* Unit tests for {@link GitUtil}.
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class GitUtilTest
|
||||
{
|
||||
|
||||
@@ -41,7 +41,6 @@ import org.mockito.junit.MockitoJUnitRunner;
|
||||
/**
|
||||
* Unit tests for {@link GitHookBranchProvider}.
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class GitHookBranchProviderTest {
|
||||
|
||||
@@ -58,7 +58,6 @@ import static org.mockito.Mockito.when;
|
||||
/**
|
||||
* Unit tests for {@link GitHookTagProvider}.
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class GitHookTagProviderTest {
|
||||
|
||||
@@ -24,45 +24,26 @@
|
||||
|
||||
package sonia.scm.repository.client.spi;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.eclipse.jgit.api.Git;
|
||||
import org.eclipse.jgit.api.errors.GitAPIException;
|
||||
|
||||
import sonia.scm.repository.client.api.RepositoryClientException;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
|
||||
public class GitAddCommand implements AddCommand
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
* @param git
|
||||
*/
|
||||
|
||||
GitAddCommand(Git git)
|
||||
{
|
||||
this.git = git;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param path
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void add(String path) throws IOException
|
||||
{
|
||||
@@ -78,6 +59,5 @@ public class GitAddCommand implements AddCommand
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
private Git git;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
package sonia.scm.repository.client.spi;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.eclipse.jgit.api.Git;
|
||||
import org.eclipse.jgit.api.errors.GitAPIException;
|
||||
@@ -32,31 +31,20 @@ import org.eclipse.jgit.api.errors.GitAPIException;
|
||||
import sonia.scm.repository.Branch;
|
||||
import sonia.scm.repository.client.api.RepositoryClientException;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.IOException;
|
||||
import org.eclipse.jgit.lib.Ref;
|
||||
import sonia.scm.repository.GitUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
|
||||
public class GitBranchCommand implements BranchCommand
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
* @param git
|
||||
*/
|
||||
|
||||
GitBranchCommand(Git git)
|
||||
{
|
||||
this.git = git;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public Branch branch(String name) throws IOException
|
||||
@@ -74,6 +62,5 @@ public class GitBranchCommand implements BranchCommand
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
private Git git;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
package sonia.scm.repository.client.spi;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.eclipse.jgit.api.Git;
|
||||
import org.eclipse.jgit.api.errors.GitAPIException;
|
||||
@@ -36,40 +35,20 @@ import sonia.scm.repository.GitChangesetConverterFactory;
|
||||
import sonia.scm.repository.GitTestHelper;
|
||||
import sonia.scm.repository.client.api.RepositoryClientException;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
|
||||
public class GitCommitCommand implements CommitCommand
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
* @param git
|
||||
*/
|
||||
|
||||
GitCommitCommand(Git git)
|
||||
{
|
||||
this.git = git;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param request
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
|
||||
@Override
|
||||
public Changeset commit(CommitRequest request) throws IOException
|
||||
{
|
||||
@@ -89,6 +68,5 @@ public class GitCommitCommand implements CommitCommand
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
private final Git git;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
package sonia.scm.repository.client.spi;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.eclipse.jgit.api.Git;
|
||||
import org.eclipse.jgit.api.errors.GitAPIException;
|
||||
@@ -34,36 +33,19 @@ import sonia.scm.repository.client.api.RepositoryClientException;
|
||||
import java.io.IOException;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class GitPushCommand implements PushCommand
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
* @param git
|
||||
* @param credentialsProvider
|
||||
*/
|
||||
|
||||
public GitPushCommand(Git git, CredentialsProvider credentialsProvider)
|
||||
{
|
||||
this.git = git;
|
||||
this.credentialsProvider = credentialsProvider;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void push() throws IOException {
|
||||
push(() -> git.push().setPushAll());
|
||||
@@ -96,9 +78,7 @@ public class GitPushCommand implements PushCommand
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
private CredentialsProvider credentialsProvider;
|
||||
|
||||
/** Field description */
|
||||
private Git git;
|
||||
}
|
||||
|
||||
@@ -24,45 +24,26 @@
|
||||
|
||||
package sonia.scm.repository.client.spi;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.eclipse.jgit.api.Git;
|
||||
import org.eclipse.jgit.api.errors.GitAPIException;
|
||||
|
||||
import sonia.scm.repository.client.api.RepositoryClientException;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
|
||||
public class GitRemoveCommand implements RemoveCommand
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
* @param git
|
||||
*/
|
||||
|
||||
GitRemoveCommand(Git git)
|
||||
{
|
||||
this.git = git;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param path
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void remove(String path) throws IOException
|
||||
{
|
||||
@@ -78,6 +59,5 @@ public class GitRemoveCommand implements RemoveCommand
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
private Git git;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
package sonia.scm.repository.client.spi;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.eclipse.jgit.api.Git;
|
||||
import org.eclipse.jgit.api.errors.GitAPIException;
|
||||
@@ -34,15 +33,10 @@ import org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider;
|
||||
import sonia.scm.repository.GitRepositoryHandler;
|
||||
import sonia.scm.repository.client.api.RepositoryClientException;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
|
||||
public class GitRepositoryClientFactoryProvider
|
||||
implements RepositoryClientFactoryProvider
|
||||
{
|
||||
@@ -118,14 +112,8 @@ public class GitRepositoryClientFactoryProvider
|
||||
return new GitRepositoryClientProvider(git, credentialsProvider);
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
package sonia.scm.repository.client.spi;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import org.eclipse.jgit.api.Git;
|
||||
@@ -36,82 +35,46 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Set;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class GitRepositoryClientProvider extends RepositoryClientProvider
|
||||
{
|
||||
|
||||
/** Field description */
|
||||
private static final Set<ClientCommand> SUPPORTED_COMMANDS =
|
||||
ImmutableSet.of(ClientCommand.ADD, ClientCommand.REMOVE,
|
||||
ClientCommand.COMMIT, ClientCommand.TAG, ClientCommand.BRANCH,
|
||||
ClientCommand.DELETE_REMOTE_BRANCH, ClientCommand.MERGE, ClientCommand.PUSH);
|
||||
|
||||
//~--- constructors ---------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
* @param git
|
||||
* @param credentialsProvider
|
||||
*/
|
||||
|
||||
GitRepositoryClientProvider(Git git)
|
||||
{
|
||||
this(git, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
* @param git
|
||||
* @param credentialsProvider
|
||||
*/
|
||||
|
||||
GitRepositoryClientProvider(Git git, CredentialsProvider credentialsProvider)
|
||||
{
|
||||
this.git = git;
|
||||
this.credentialsProvider = credentialsProvider;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void close() throws IOException
|
||||
{
|
||||
GitUtil.close(git.getRepository());
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
@Override
|
||||
public AddCommand getAddCommand()
|
||||
{
|
||||
return new GitAddCommand(git);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
@Override
|
||||
public BranchCommand getBranchCommand()
|
||||
{
|
||||
@@ -128,60 +91,35 @@ public class GitRepositoryClientProvider extends RepositoryClientProvider
|
||||
return new GitCheckoutCommand(git);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
@Override
|
||||
public CommitCommand getCommitCommand()
|
||||
{
|
||||
return new GitCommitCommand(git);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
@Override
|
||||
public PushCommand getPushCommand()
|
||||
{
|
||||
return new GitPushCommand(git, credentialsProvider);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
@Override
|
||||
public RemoveCommand getRemoveCommand()
|
||||
{
|
||||
return new GitRemoveCommand(git);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
@Override
|
||||
public Set<ClientCommand> getSupportedClientCommands()
|
||||
{
|
||||
return SUPPORTED_COMMANDS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
@Override
|
||||
public TagCommand getTagCommand()
|
||||
{
|
||||
@@ -200,9 +138,7 @@ public class GitRepositoryClientProvider extends RepositoryClientProvider
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
private CredentialsProvider credentialsProvider;
|
||||
|
||||
/** Field description */
|
||||
private Git git;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
package sonia.scm.repository.client.spi;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import org.eclipse.jgit.api.Git;
|
||||
@@ -39,38 +38,18 @@ import sonia.scm.repository.client.api.RepositoryClientException;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class GitTagCommand implements TagCommand
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
* @param git
|
||||
*/
|
||||
|
||||
GitTagCommand(Git git)
|
||||
{
|
||||
this.git = git;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param request
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
|
||||
@Override
|
||||
public Tag tag(TagRequest request) throws IOException
|
||||
{
|
||||
@@ -128,6 +107,5 @@ public class GitTagCommand implements TagCommand
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
private Git git;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
package sonia.scm.repository.spi;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.junit.After;
|
||||
import sonia.scm.api.v2.resources.GitRepositoryConfigStoreProvider;
|
||||
@@ -32,18 +31,11 @@ import sonia.scm.repository.GitConfig;
|
||||
import sonia.scm.repository.GitRepositoryConfig;
|
||||
import sonia.scm.store.InMemoryConfigurationStoreFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
|
||||
public class AbstractGitCommandTestBase extends ZippedRepositoryTestBase
|
||||
{
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*/
|
||||
@After
|
||||
@After
|
||||
public void close()
|
||||
{
|
||||
if (context != null) {
|
||||
@@ -52,12 +44,7 @@ public class AbstractGitCommandTestBase extends ZippedRepositoryTestBase
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
protected GitContext createContext()
|
||||
{
|
||||
if (context == null)
|
||||
@@ -68,26 +55,15 @@ public class AbstractGitCommandTestBase extends ZippedRepositoryTestBase
|
||||
return context;
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
@Override
|
||||
protected String getType()
|
||||
{
|
||||
return "git";
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
@Override
|
||||
protected String getZippedRepositoryResource()
|
||||
{
|
||||
@@ -96,6 +72,5 @@ public class AbstractGitCommandTestBase extends ZippedRepositoryTestBase
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
private GitContext context;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
package sonia.scm.repository.spi;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.io.Files;
|
||||
@@ -53,11 +52,7 @@ import static org.junit.Assert.assertEquals;
|
||||
import static org.mockito.Mockito.lenient;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class AbstractRemoteCommandTestBase {
|
||||
|
||||
/**
|
||||
@@ -97,7 +92,6 @@ public class AbstractRemoteCommandTestBase {
|
||||
Transport.unregister(proto);
|
||||
}
|
||||
|
||||
//~--- set methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
@@ -110,7 +104,6 @@ public class AbstractRemoteCommandTestBase {
|
||||
Transport.register(proto);
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
@@ -127,14 +120,7 @@ public class AbstractRemoteCommandTestBase {
|
||||
assertEquals(expected.getShortMessage(), actual.getDescription());
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
* @param git
|
||||
* @param message
|
||||
* @return
|
||||
* @throws GitAPIException
|
||||
*/
|
||||
|
||||
protected RevCommit commit(Git git, String message) throws GitAPIException {
|
||||
User trillian = UserTestData.createTrillian();
|
||||
CommitCommand cc = git.commit();
|
||||
@@ -165,50 +151,32 @@ public class AbstractRemoteCommandTestBase {
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Field description
|
||||
*/
|
||||
|
||||
@Rule
|
||||
public TemporaryFolder tempFolder = new TemporaryFolder();
|
||||
|
||||
/**
|
||||
* Field description
|
||||
*/
|
||||
|
||||
protected GitRepositoryHandler handler;
|
||||
|
||||
/**
|
||||
* Field description
|
||||
*/
|
||||
|
||||
protected Repository incomingRepository;
|
||||
|
||||
/**
|
||||
* Field description
|
||||
*/
|
||||
|
||||
protected Git incoming;
|
||||
|
||||
/**
|
||||
* Field description
|
||||
*/
|
||||
|
||||
protected File incomingDirectory;
|
||||
|
||||
/**
|
||||
* Field description
|
||||
*/
|
||||
|
||||
protected Git outgoing;
|
||||
|
||||
/**
|
||||
* Field description
|
||||
*/
|
||||
|
||||
protected File outgoingDirectory;
|
||||
|
||||
/**
|
||||
* Field description
|
||||
*/
|
||||
|
||||
protected Repository outgoingRepository;
|
||||
|
||||
/**
|
||||
* Field description
|
||||
*/
|
||||
|
||||
private ScmTransportProtocol proto;
|
||||
|
||||
protected ScmEventBus eventBus;
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
package sonia.scm.repository.spi;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.junit.Test;
|
||||
import sonia.scm.repository.BlameLine;
|
||||
@@ -36,12 +35,9 @@ import java.io.IOException;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Unit tests for {@link GitBlameCommand}.
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class GitBlameCommandTest extends AbstractGitCommandTestBase
|
||||
{
|
||||
@@ -72,12 +68,7 @@ public class GitBlameCommandTest extends AbstractGitCommandTestBase
|
||||
assertEquals("3f76a12f08a6ba0dc988c68b7f0b2cd190efc3c4", result.getLine(0).getRevision());
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
|
||||
@Test
|
||||
public void testGetBlameResult() throws IOException
|
||||
{
|
||||
@@ -105,12 +96,7 @@ public class GitBlameCommandTest extends AbstractGitCommandTestBase
|
||||
line.getAuthor().getMail());
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
|
||||
@Test
|
||||
public void testGetBlameResultWithRevision()
|
||||
throws IOException
|
||||
@@ -130,12 +116,7 @@ public class GitBlameCommandTest extends AbstractGitCommandTestBase
|
||||
checkFirstLine(line);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param line
|
||||
*/
|
||||
|
||||
private void checkFirstLine(BlameLine line)
|
||||
{
|
||||
assertEquals(1, line.getLineNumber());
|
||||
@@ -148,12 +129,7 @@ public class GitBlameCommandTest extends AbstractGitCommandTestBase
|
||||
assertEquals("douglas.adams@hitchhiker.com", line.getAuthor().getMail());
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
private GitBlameCommand createCommand()
|
||||
{
|
||||
return new GitBlameCommand(createContext());
|
||||
|
||||
@@ -52,7 +52,6 @@ import static sonia.scm.repository.spi.SyncAsyncExecutors.synchronousExecutor;
|
||||
/**
|
||||
* Unit tests for {@link GitBrowseCommand}.
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class GitBrowseCommandTest extends AbstractGitCommandTestBase {
|
||||
|
||||
|
||||
@@ -38,7 +38,6 @@ import static sonia.scm.repository.spi.SyncAsyncExecutors.synchronousExecutor;
|
||||
/**
|
||||
* Unit tests for {@link GitBrowseCommand}.
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class GitBrowseCommand_RecursiveDirectoryNameTest extends AbstractGitCommandTestBase {
|
||||
|
||||
|
||||
@@ -49,7 +49,6 @@ import static org.mockito.Mockito.when;
|
||||
*
|
||||
* TODO add not found test
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class GitCatCommandTest extends AbstractGitCommandTestBase {
|
||||
|
||||
|
||||
@@ -41,9 +41,7 @@ import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
/**
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
|
||||
public class GitIncomingCommandTest
|
||||
extends AbstractRemoteCommandTestBase {
|
||||
|
||||
|
||||
@@ -55,7 +55,6 @@ import static org.junit.Assert.assertNotNull;
|
||||
* * 36b19e4 b
|
||||
* * c2190a9 a
|
||||
* </pre>
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class GitLogCommandAncestorTest extends AbstractGitCommandTestBase
|
||||
{
|
||||
|
||||
@@ -55,7 +55,6 @@ import static org.mockito.Mockito.when;
|
||||
/**
|
||||
* Unit tests for {@link GitLogCommand}.
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class GitLogCommandTest extends AbstractGitCommandTestBase
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
package sonia.scm.repository.spi;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.eclipse.jgit.api.errors.GitAPIException;
|
||||
import org.eclipse.jgit.revwalk.RevCommit;
|
||||
@@ -40,12 +39,9 @@ import java.io.IOException;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Unit tests for {@link OutgoingCommand}.
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class GitOutgoingCommandTest extends AbstractRemoteCommandTestBase
|
||||
{
|
||||
@@ -123,12 +119,7 @@ public class GitOutgoingCommandTest extends AbstractRemoteCommandTestBase
|
||||
assertCommitsEquals(c2, cpr.getChangesets().get(0));
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
|
||||
@Test
|
||||
public void testGetOutgoingChangesetsWithEmptyRepository()
|
||||
throws IOException
|
||||
@@ -145,12 +136,7 @@ public class GitOutgoingCommandTest extends AbstractRemoteCommandTestBase
|
||||
assertEquals(0, cpr.getTotal());
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
private GitOutgoingCommand createCommand()
|
||||
{
|
||||
return new GitOutgoingCommand(
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
package sonia.scm.repository.spi;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.eclipse.jgit.api.errors.GitAPIException;
|
||||
import org.eclipse.jgit.revwalk.RevCommit;
|
||||
@@ -41,12 +40,7 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class GitPushCommandTest extends AbstractRemoteCommandTestBase
|
||||
{
|
||||
|
||||
@@ -130,12 +124,7 @@ public class GitPushCommandTest extends AbstractRemoteCommandTestBase
|
||||
assertThat(commits.hasNext()).isFalse();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
private GitPushCommand createCommand()
|
||||
{
|
||||
return new GitPushCommand(handler, new GitContext(outgoingDirectory, outgoingRepository, null, new GitConfig()));
|
||||
|
||||
@@ -24,14 +24,11 @@
|
||||
|
||||
package sonia.scm.web;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Unit tests for {@link GitUserAgentProvider}.
|
||||
*
|
||||
|
||||
@@ -42,7 +42,6 @@ import static org.mockito.Mockito.when;
|
||||
/**
|
||||
* Unit tests for {@link LfsBlobStoreFactory}.
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class LfsBlobStoreFactoryTest {
|
||||
|
||||
Reference in New Issue
Block a user