fix git tag command unit test

This commit is contained in:
Konstantin Schaper
2020-12-02 09:39:17 +01:00
parent 0dbea12a62
commit 2fa4972883
2 changed files with 28 additions and 14 deletions

View File

@@ -65,14 +65,12 @@ import static sonia.scm.ContextEntry.ContextBuilder.entity;
import static sonia.scm.NotFoundException.notFound;
public class GitTagCommand extends AbstractGitCommand implements TagCommand {
private final GPG gpg;
private final HookContextFactory hookContextFactory;
private final ScmEventBus eventBus;
@Inject
GitTagCommand(GitContext context, GPG gpg, HookContextFactory hookContextFactory, ScmEventBus eventBus) {
GitTagCommand(GitContext context, HookContextFactory hookContextFactory, ScmEventBus eventBus) {
super(context);
this.gpg = gpg;
this.hookContextFactory = hookContextFactory;
this.eventBus = eventBus;
}
@@ -114,20 +112,12 @@ public class GitTagCommand extends AbstractGitCommand implements TagCommand {
User user = SecurityUtils.getSubject().getPrincipals().oneByType(User.class);
PersonIdent taggerIdent = new PersonIdent(user.getDisplayName(), user.getMail());
// Ref ref =
git.tag()
.setObjectId(revObject)
.setTagger(taggerIdent)
.setName(name)
.call();
// Uncomment lines once jgit added support for signing tags
// try (RevWalk walk = new RevWalk(git.getRepository())) {
// revObject = walk.parseTag(ref.getObjectId());
// final Optional<Signature> tagSignature = GitUtil.getTagSignature(revObject, gpg, walk);
// tagSignature.ifPresent(tag::addSignature);
// }
eventBus.post(new PostReceiveRepositoryHookEvent(hookEvent));
return tag;