From 531259bec09d4f0989b376d8152e8b7ae3aed341 Mon Sep 17 00:00:00 2001 From: Eduard Heimbuch Date: Mon, 28 Oct 2019 11:45:42 +0100 Subject: [PATCH] check if request branch contains revision --- .../main/java/sonia/scm/repository/spi/GitLogCommand.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java index ffed8c5ad4..7f10948ad8 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java @@ -132,7 +132,9 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand { converter = new GitChangesetConverter(gr, revWalk); - if (request != null && !Strings.isNullOrEmpty(request.getBranch())) { + if (request != null && + !Strings.isNullOrEmpty(request.getBranch()) && + revWalk.isMergedInto(commit, findTipCommitForRequestBranch(request, gr, revWalk))) { changeset = converter.createChangeset(commit, request.getBranch()); } else { changeset = converter.createChangeset(commit); @@ -163,6 +165,10 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand return changeset; } + private RevCommit findTipCommitForRequestBranch(LogCommandRequest request, Repository gr, RevWalk revWalk) throws IOException { + return revWalk.parseCommit(GitUtil.getCommit(gr, revWalk, gr.findRef(request.getBranch()))); + } + /** * Method description *