mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-06 21:45:43 +01:00
Merge with 2.0.0-m3
This commit is contained in:
@@ -37,12 +37,12 @@ package sonia.scm.repository.client.spi;
|
||||
import org.eclipse.jgit.api.Git;
|
||||
import org.eclipse.jgit.api.errors.GitAPIException;
|
||||
import org.eclipse.jgit.transport.CredentialsProvider;
|
||||
|
||||
import sonia.scm.repository.client.api.RepositoryClientException;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -73,11 +73,20 @@ public class GitPushCommand implements PushCommand
|
||||
* @throws IOException
|
||||
*/
|
||||
@Override
|
||||
public void push() throws IOException
|
||||
public void push() throws IOException {
|
||||
push(() -> git.push().setPushAll());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pushTags() throws IOException {
|
||||
push(() -> git.push().setPushTags());
|
||||
}
|
||||
|
||||
private void push(Supplier<org.eclipse.jgit.api.PushCommand> commandSupplier) throws RepositoryClientException
|
||||
{
|
||||
try
|
||||
{
|
||||
org.eclipse.jgit.api.PushCommand cmd = git.push().setPushAll();
|
||||
org.eclipse.jgit.api.PushCommand cmd = commandSupplier.get();
|
||||
|
||||
if (credentialsProvider != null)
|
||||
{
|
||||
|
||||
@@ -35,22 +35,20 @@ package sonia.scm.repository.client.spi;
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
|
||||
import org.eclipse.jgit.api.Git;
|
||||
import org.eclipse.jgit.api.errors.GitAPIException;
|
||||
import org.eclipse.jgit.lib.ObjectId;
|
||||
import org.eclipse.jgit.lib.Ref;
|
||||
import org.eclipse.jgit.revwalk.RevObject;
|
||||
import org.eclipse.jgit.revwalk.RevWalk;
|
||||
|
||||
import sonia.scm.repository.GitUtil;
|
||||
import sonia.scm.repository.Tag;
|
||||
import sonia.scm.repository.client.api.RepositoryClientException;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
@@ -119,7 +117,11 @@ public class GitTagCommand implements TagCommand
|
||||
ref = git.tag().setObjectId(revObject).call();
|
||||
}
|
||||
|
||||
tag = new Tag(request.getName(), ref.getPeeledObjectId().toString());
|
||||
if (ref.isPeeled()) {
|
||||
tag = new Tag(request.getName(), ref.getPeeledObjectId().toString());
|
||||
} else {
|
||||
tag = new Tag(request.getName(), ref.getObjectId().toString());
|
||||
}
|
||||
|
||||
}
|
||||
catch (GitAPIException ex)
|
||||
|
||||
Reference in New Issue
Block a user