Skip to content

The Unified and Autonomous Development Platform

Populate mentions when comment outside of pull request

robin shen093a7582092a
diff --git a/core/src/main/java/com/gitplex/server/git/Blame.java b/core/src/main/java/com/gitplex/server/git/BlameBlock.java
similarity index 74%
rename from core/src/main/java/com/gitplex/server/git/Blame.java
rename to core/src/main/java/com/gitplex/server/git/BlameBlock.java
index 92f889f137..2e16a6b633 100644
--- a/core/src/main/java/com/gitplex/server/git/Blame.java
+++ b/core/src/main/java/com/gitplex/server/git/BlameBlock.java
@@ -6,13 +6,13 @@ import org.apache.commons.lang3.StringUtils;
import com.gitplex.jsymbol.Range;
-public class Blame {
+public class BlameBlock {
private final BlameCommit commit;
private final List<Range> ranges;
- public Blame(BlameCommit commit, List<Range> ranges) {
+ public BlameBlock(BlameCommit commit, List<Range> ranges) {
this.commit = commit;
this.ranges = ranges;
}
@@ -21,6 +21,12 @@ public class Blame {
return commit;
}
+ /**
+ * Get ranges of this blame block
+ *
+ * @return
+ * list of ranges. Range is 0-indexed and inclusive for from and to
+ */
public List<Range> getRanges() {
return ranges;
}
diff --git a/core/src/main/java/com/gitplex/server/git/command/AdvertiseReceiveRefsCommand.java b/core/src/main/java/com/gitplex/server/git/command/AdvertiseReceiveRefsCommand.java
index 88f3eb044a..818398a83a 100644
--- a/core/src/main/java/com/gitplex/server/git/command/AdvertiseReceiveRefsCommand.java
+++ b/core/src/main/java/com/gitplex/server/git/command/AdvertiseReceiveRefsCommand.java
@@ -16,8 +16,8 @@ public class AdvertiseReceiveRefsCommand extends GitCommand<Void> {
private OutputStream output;
- public AdvertiseReceiveRefsCommand(File repoDir) {
- super(repoDir);
+ public AdvertiseReceiveRefsCommand(File gitDir) {
+ super(gitDir);
}
public AdvertiseReceiveRefsCommand output(OutputStream output) {
diff --git a/core/src/main/java/com/gitplex/server/git/command/AdvertiseUploadRefsCommand.java b/core/src/main/java/com/gitplex/server/git/command/AdvertiseUploadRefsCommand.java
index 8e05897b5f..117aeba3ea 100644
--- a/core/src/main/java/com/gitplex/server/git/command/AdvertiseUploadRefsCommand.java
+++ b/core/src/main/java/com/gitplex/server/git/command/AdvertiseUploadRefsCommand.java
@@ -16,8 +16,8 @@ public class AdvertiseUploadRefsCommand extends GitCommand<Void> {
private OutputStream output;
- public AdvertiseUploadRefsCommand(File repoDir) {
- super(repoDir);
+ public AdvertiseUploadRefsCommand(File gitDir) {
+ super(gitDir);
}
public AdvertiseUploadRefsCommand output(OutputStream output) {
diff --git a/core/src/main/java/com/gitplex/server/git/command/BlameCommand.java b/core/src/main/java/com/gitplex/server/git/command/BlameCommand.java
index 519ccba1c3..ad1175fdde 100644
--- a/core/src/main/java/com/gitplex/server/git/command/BlameCommand.java
+++ b/core/src/main/java/com/gitplex/server/git/command/BlameCommand.java
@@ -2,6 +2,7 @@ package com.gitplex.server.git.command;
import java.io.File;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@@ -9,6 +10,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
+import javax.annotation.Nullable;
+
import org.apache.commons.collections4.map.AbstractReferenceMap.ReferenceStrength;
import org.apache.commons.collections4.map.ReferenceMap;
import org.apache.commons.lang3.StringUtils;
@@ -16,7 +19,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.gitplex.jsymbol.Range;
-import com.gitplex.server.git.Blame;
+import com.gitplex.server.git.BlameBlock;
import com.gitplex.server.git.BlameCommit;
import com.gitplex.server.git.GitUtils;
import com.gitplex.server.util.execution.Commandline;
@@ -24,11 +27,11 @@ import com.gitplex.server.util.execution.ExecuteResult;
import com.gitplex.server.util.execution.LineConsumer;
import com.google.common.base.Preconditions;
-public class BlameCommand extends GitCommand<Map<String, Blame>> {
+public class BlameCommand extends GitCommand<Collection<BlameBlock>> {
private static final Logger logger = LoggerFactory.getLogger(BlameCommand.class);
- private static final ReferenceMap<String, Map<String, Blame>> cache =
+ private static final ReferenceMap<String, Collection<BlameBlock>> cache =
new ReferenceMap<>(ReferenceStrength.HARD, ReferenceStrength.SOFT);
private static final int CACHE_THRESHOLD = 1000;
@@ -37,8 +40,10 @@ public class BlameCommand extends GitCommand<Map<String, Blame>> {
private String file;
- public BlameCommand(File repoDir) {
- super(repoDir);
+ private Range range;
+
+ public BlameCommand(File gitDir) {
+ super(gitDir);
}
public BlameCommand commitHash(String commitHash) {
@@ -51,34 +56,56 @@ public class BlameCommand extends GitCommand<Map<String, Blame>> {
return this;
}
+ /**
+ * Calculate blames of specified range
+ * @param range
+ * 0-indexed and inclusive from and to
+ * @return
+ */
+ public BlameCommand range(@Nullable Range range) {
+ this.range = range;
+ return this;
+ }
+
private Commandline buildCmd() {
Commandline cmd = cmd().addArgs("blame", "--porcelain");
+ if (range != null)
+ cmd.addArgs("-L" + (range.getFrom()+1) + "," + (range.getTo()+1));
cmd.addArgs(commitHash, "--", file);
return cmd;
}
@Override
- public Map<String, Blame> call() {
+ public Collection<BlameBlock> call() {
Preconditions.checkArgument(commitHash!=null && GitUtils.isHash(commitHash), "commit hash has to be specified.");
Preconditions.checkNotNull(file, "file parameter has to be specified.");
- String cacheKey = commitHash + ":" + file;
+ String cacheKey = commitHash + ":" + file + ":" + (range!=null?range.toString():"");
- Map<String, Blame> cached = cache.get(cacheKey);
+ Collection<BlameBlock> cached = cache.get(cacheKey);
if (cached != null)
return cached;
Commandline cmd = buildCmd();
- final Map<String, Blame> blames = new HashMap<>();
- final Map<String, BlameCommit> commitMap = new HashMap<>();
+ Map<String, BlameBlock> blocks = new HashMap<>();
+ Map<String, BlameCommit> commitMap = new HashMap<>();
+
+ AtomicReference<BlameCommit> commitRef = new AtomicReference<>(null);
+ CommitBuilder commitBuilder = new CommitBuilder();
- final AtomicReference<BlameCommit> commitRef = new AtomicReference<>(null);
- final CommitBuilder commitBuilder = new CommitBuilder();
+ AtomicBoolean endOfFile = new AtomicBoolean(false);
- final AtomicBoolean endOfFile = new AtomicBoolean(false);
- final AtomicInteger beginLine = new AtomicInteger(0);
- final AtomicInteger endLine = new AtomicInteger(0);
+ AtomicInteger beginLine;
+ AtomicInteger endLine;
+
+ if (range != null) {
+ beginLine = new AtomicInteger(range.getFrom());
+ endLine = new AtomicInteger(range.getFrom());
+ } else {
+ beginLine = new AtomicInteger(0);
+ endLine = new AtomicInteger(0);
+ }
long time = System.currentTimeMillis();
@@ -95,12 +122,12 @@ public class BlameCommand extends GitCommand<Map<String, Blame>> {
commitBuilder.hash = StringUtils.substringBefore(line, " ");
BlameCommit commit = commitRef.get();
if (commit != null && !commitBuilder.hash.equals(commit.getHash())) {
- Blame blame = blames.get(commit.getHash());
- if (blame == null) {
- blame = new Blame(commit, new ArrayList<>());
- blames.put(commit.getHash(), blame);
+ BlameBlock block = blocks.get(commit.getHash());
+ if (block == null) {
+ block = new BlameBlock(commit, new ArrayList<>());
+ blocks.put(commit.getHash(), block);
}
- blame.getRanges().add(new Range(beginLine.get(), endLine.get()));
+ block.getRanges().add(new Range(beginLine.get(), endLine.get()-1));
commitRef.set(null);
beginLine.set(endLine.get());
}
@@ -143,18 +170,18 @@ public class BlameCommand extends GitCommand<Map<String, Blame>> {
if (endLine.get() > beginLine.get()) {
BlameCommit commit = commitRef.get();
- Blame blame = blames.get(commit.getHash());
- if (blame == null) {
- blame = new Blame(commit, new ArrayList<Range>());
- blames.put(commit.getHash(), blame);
+ BlameBlock block = blocks.get(commit.getHash());
+ if (block == null) {
+ block = new BlameBlock(commit, new ArrayList<Range>());
+ blocks.put(commit.getHash(), block);
}
- blame.getRanges().add(new Range(beginLine.get(), endLine.get()));
+ block.getRanges().add(new Range(beginLine.get(), endLine.get()-1));
}
if (System.currentTimeMillis()-time > CACHE_THRESHOLD)
- cache.put(cacheKey, blames);
+ cache.put(cacheKey, blocks.values());
- return blames;
+ return blocks.values();
}
private static class CommitBuilder {
diff --git a/core/src/main/java/com/gitplex/server/git/command/CloneCommand.java b/core/src/main/java/com/gitplex/server/git/command/CloneCommand.java
index 06f3a68b03..fe9cd49440 100644
--- a/core/src/main/java/com/gitplex/server/git/command/CloneCommand.java
+++ b/core/src/main/java/com/gitplex/server/git/command/CloneCommand.java
@@ -25,8 +25,8 @@ public class CloneCommand extends GitCommand<Void> {
private String branch;
- public CloneCommand(File repoDir) {
- super(repoDir);
+ public CloneCommand(File gitDir) {
+ super(gitDir);
}
public CloneCommand from(String from) {
diff --git a/core/src/main/java/com/gitplex/server/git/command/FetchCommand.java b/core/src/main/java/com/gitplex/server/git/command/FetchCommand.java
index bcf1ccb941..d4ba3c9796 100644
--- a/core/src/main/java/com/gitplex/server/git/command/FetchCommand.java
+++ b/core/src/main/java/com/gitplex/server/git/command/FetchCommand.java
@@ -17,8 +17,8 @@ public class FetchCommand extends GitCommand<Void> {
private String[] refspec = new String[0];
- public FetchCommand(final File repoDir) {
- super(repoDir);
+ public FetchCommand(final File gitDir) {
+ super(gitDir);
}
public FetchCommand from(String from) {
diff --git a/core/src/main/java/com/gitplex/server/git/command/ReceiveCommand.java b/core/src/main/java/com/gitplex/server/git/command/ReceiveCommand.java
index ee2a0d8a25..a6219c4a81 100644
--- a/core/src/main/java/com/gitplex/server/git/command/ReceiveCommand.java
+++ b/core/src/main/java/com/gitplex/server/git/command/ReceiveCommand.java
@@ -20,8 +20,8 @@ public class ReceiveCommand extends GitCommand<Void> {
private OutputStream output;
- public ReceiveCommand(File repoDir, Map<String, String> environments) {
- super(repoDir, environments);
+ public ReceiveCommand(File gitDir, Map<String, String> environments) {
+ super(gitDir, environments);
}
public ReceiveCommand input(InputStream input) {
diff --git a/core/src/main/java/com/gitplex/server/git/command/UploadCommand.java b/core/src/main/java/com/gitplex/server/git/command/UploadCommand.java
index 2f0bbc891c..5d670223f7 100644
--- a/core/src/main/java/com/gitplex/server/git/command/UploadCommand.java
+++ b/core/src/main/java/com/gitplex/server/git/command/UploadCommand.java
@@ -20,8 +20,8 @@ public class UploadCommand extends GitCommand<Void> {
private OutputStream output;
- public UploadCommand(File repoDir, Map<String, String> environments) {
- super(repoDir, environments);
+ public UploadCommand(File gitDir, Map<String, String> environments) {
+ super(gitDir, environments);
}
public UploadCommand input(InputStream input) {
diff --git a/core/src/main/java/com/gitplex/server/model/Project.java b/core/src/main/java/com/gitplex/server/model/Project.java
index 724961a9fa..9b590db0c1 100644
--- a/core/src/main/java/com/gitplex/server/model/Project.java
+++ b/core/src/main/java/com/gitplex/server/model/Project.java
@@ -58,21 +58,25 @@ import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.validator.constraints.NotEmpty;
+import com.gitplex.jsymbol.Range;
import com.gitplex.launcher.loader.ListenerRegistry;
import com.gitplex.launcher.loader.LoaderUtils;
import com.gitplex.server.GitPlex;
import com.gitplex.server.event.RefUpdated;
+import com.gitplex.server.git.BlameBlock;
import com.gitplex.server.git.Blob;
import com.gitplex.server.git.BlobIdent;
import com.gitplex.server.git.BlobIdentFilter;
import com.gitplex.server.git.GitUtils;
import com.gitplex.server.git.RefInfo;
import com.gitplex.server.git.Submodule;
+import com.gitplex.server.git.command.BlameCommand;
import com.gitplex.server.git.exception.NotFileException;
import com.gitplex.server.git.exception.ObjectNotFoundException;
import com.gitplex.server.manager.ConfigManager;
import com.gitplex.server.manager.ProjectManager;
import com.gitplex.server.manager.StorageManager;
+import com.gitplex.server.manager.UserManager;
import com.gitplex.server.model.support.BranchProtection;
import com.gitplex.server.model.support.CommitMessageTransformSetting;
import com.gitplex.server.model.support.TagProtection;
@@ -878,5 +882,22 @@ public class Project extends AbstractEntity {
public String toString() {
return getName();
}
+
+ public List<User> getAuthors(String filePath, ObjectId commitId, @Nullable Range range) {
+ BlameCommand cmd = new BlameCommand(getGitDir());
+ cmd.commitHash(commitId.name());
+ cmd.file(filePath);
+ cmd.range(range);
+
+ List<User> authors = new ArrayList<>();
+ UserManager userManager = GitPlex.getInstance(UserManager.class);
+ for (BlameBlock block: cmd.call()) {
+ User author = userManager.find(block.getCommit().getAuthor());
+ if (author != null && !authors.contains(author))
+ authors.add(author);
+ }
+
+ return authors;
+ }
}
diff --git a/core/src/test/java/com/gitplex/server/git/command/BlameCommandTest.java b/core/src/test/java/com/gitplex/server/git/command/BlameCommandTest.java
index 5c7f261a6d..8b3f741218 100644
--- a/core/src/test/java/com/gitplex/server/git/command/BlameCommandTest.java
+++ b/core/src/test/java/com/gitplex/server/git/command/BlameCommandTest.java
@@ -2,13 +2,13 @@ package com.gitplex.server.git.command;
import static org.junit.Assert.assertEquals;
-import java.util.Map;
+import java.util.Collection;
import org.junit.Test;
+import com.gitplex.jsymbol.Range;
import com.gitplex.server.git.AbstractGitTest;
-import com.gitplex.server.git.Blame;
-import com.gitplex.server.git.command.BlameCommand;
+import com.gitplex.server.git.BlameBlock;
public class BlameCommandTest extends AbstractGitTest {
@@ -28,12 +28,12 @@ public class BlameCommandTest extends AbstractGitTest {
"initial commit");
String commitHash = git.getRepository().resolve("master").name();
- Map<String, Blame> blames = new BlameCommand(git.getRepository().getDirectory())
+ Collection<BlameBlock> blames = new BlameCommand(git.getRepository().getDirectory())
.commitHash(commitHash)
.file("file")
.call();
assertEquals(1, blames.size());
- assertEquals(commitHash + ": 0-9", blames.get(commitHash).toString());
+ assertEquals(commitHash + ": 0-8", blames.iterator().next().toString());
addFileAndCommit(
"file",
@@ -52,12 +52,13 @@ public class BlameCommandTest extends AbstractGitTest {
blames = new BlameCommand(git.getRepository().getDirectory())
.commitHash(commitHash)
.file("file")
+ .range(new Range(5, 8))
.call();
assertEquals(2, blames.size());
- assertEquals(commitHash + ": 0-1, 8-9", blames.get(commitHash).toString());
+ assertEquals(commitHash + ": 8-8", getBlock(blames, commitHash).toString());
commitHash = git.getRepository().resolve("master~1").name();
- assertEquals(commitHash + ": 1-8", blames.get(commitHash).toString());
+ assertEquals(commitHash + ": 5-7", getBlock(blames, commitHash).toString());
addFileAndCommit(
"file",
@@ -73,7 +74,14 @@ public class BlameCommandTest extends AbstractGitTest {
commitHash = git.getRepository().resolve("master~1").name();
assertEquals(1, blames.size());
- assertEquals(commitHash + ": 0-2", blames.get(commitHash).toString());
+ assertEquals(commitHash + ": 0-1", getBlock(blames, commitHash).toString());
}
+ private BlameBlock getBlock(Collection<BlameBlock> blameBlocks, String commitHash) {
+ for (BlameBlock block: blameBlocks) {
+ if (block.getCommit().getHash().equals(commitHash))
+ return block;
+ }
+ return null;
+ }
}
diff --git a/web/src/main/java/com/gitplex/server/web/component/diff/blob/text/TextDiffPanel.java b/web/src/main/java/com/gitplex/server/web/component/diff/blob/text/TextDiffPanel.java
index d95cf514cc..9fdc119b6e 100644
--- a/web/src/main/java/com/gitplex/server/web/component/diff/blob/text/TextDiffPanel.java
+++ b/web/src/main/java/com/gitplex/server/web/component/diff/blob/text/TextDiffPanel.java
@@ -42,7 +42,7 @@ import com.gitplex.jsyntax.TextToken;
import com.gitplex.jsyntax.TokenUtils;
import com.gitplex.jsyntax.Tokenized;
import com.gitplex.server.GitPlex;
-import com.gitplex.server.git.Blame;
+import com.gitplex.server.git.BlameBlock;
import com.gitplex.server.git.BlameCommit;
import com.gitplex.server.git.BlobChange;
import com.gitplex.server.git.BlobIdent;
@@ -154,9 +154,9 @@ public class TextDiffPanel extends Panel implements SourceAware {
String oldPath = change.getOldBlobIdent().path;
if (oldPath != null) {
cmd.commitHash(getOldCommit().name()).file(oldPath);
- for (Blame blame: cmd.call().values()) {
+ for (BlameBlock blame: cmd.call()) {
for (Range range: blame.getRanges()) {
- for (int i=range.getFrom(); i<range.getTo(); i++)
+ for (int i=range.getFrom(); i<=range.getTo(); i++)
blameInfo.oldBlame.put(i, blame.getCommit());
}
}
@@ -164,9 +164,9 @@ public class TextDiffPanel extends Panel implements SourceAware {
String newPath = change.getNewBlobIdent().path;
if (newPath != null) {
cmd.commitHash(getNewCommit().name()).file(newPath);
- for (Blame blame: cmd.call().values()) {
+ for (BlameBlock blame: cmd.call()) {
for (Range range: blame.getRanges()) {
- for (int i=range.getFrom(); i<range.getTo(); i++)
+ for (int i=range.getFrom(); i<=range.getTo(); i++)
blameInfo.newBlame.put(i, blame.getCommit());
}
}
diff --git a/web/src/main/java/com/gitplex/server/web/component/diff/revision/RevisionDiffPanel.java b/web/src/main/java/com/gitplex/server/web/component/diff/revision/RevisionDiffPanel.java
index 7bd306ae64..9176142933 100644
--- a/web/src/main/java/com/gitplex/server/web/component/diff/revision/RevisionDiffPanel.java
+++ b/web/src/main/java/com/gitplex/server/web/component/diff/revision/RevisionDiffPanel.java
@@ -68,6 +68,7 @@ import com.gitplex.server.manager.CodeCommentManager;
import com.gitplex.server.model.CodeComment;
import com.gitplex.server.model.Project;
import com.gitplex.server.model.PullRequest;
+import com.gitplex.server.model.User;
import com.gitplex.server.model.support.CompareContext;
import com.gitplex.server.model.support.MarkPos;
import com.gitplex.server.model.support.ProjectAndRevision;
@@ -825,7 +826,23 @@ public class RevisionDiffPanel extends Panel {
String autosaveKey = "autosave:addCodeCommentOnDiff:" + projectModel.getObject().getId()
+ ":" + change.getPath();
CommentInput contentInput;
- form.add(contentInput = new CommentInput("content", Model.of(""), true) {
+
+ StringBuilder mentions = new StringBuilder();
+
+ if (requestModel.getObject() == null) {
+ /*
+ * Outside of pull request, no one will be notified of the comment. So we automatically
+ * mention authors of commented lines
+ */
+ Range range = new Range(markPos.getRange().getBeginLine(), markPos.getRange().getEndLine());
+ ObjectId commitId = ObjectId.fromString(markPos.getCommit());
+ for (User user: projectModel.getObject().getAuthors(markPos.getPath(), commitId, range)) {
+ if (user.getEmail() != null)
+ mentions.append("@").append(user.getName()).append(" ");
+ }
+ }
+
+ form.add(contentInput = new CommentInput("content", Model.of(mentions.toString()), true) {
@Override
protected ProjectAttachmentSupport getAttachmentSupport() {
diff --git a/web/src/main/java/com/gitplex/server/web/page/project/blob/render/renderers/source/SourceViewPanel.java b/web/src/main/java/com/gitplex/server/web/page/project/blob/render/renderers/source/SourceViewPanel.java
index faeec5c545..b866de7441 100644
--- a/web/src/main/java/com/gitplex/server/web/page/project/blob/render/renderers/source/SourceViewPanel.java
+++ b/web/src/main/java/com/gitplex/server/web/page/project/blob/render/renderers/source/SourceViewPanel.java
@@ -59,7 +59,7 @@ import com.gitplex.jsymbol.SymbolExtractor;
import com.gitplex.jsymbol.SymbolExtractorRegistry;
import com.gitplex.jsymbol.TokenPosition;
import com.gitplex.server.GitPlex;
-import com.gitplex.server.git.Blame;
+import com.gitplex.server.git.BlameBlock;
import com.gitplex.server.git.Blob;
import com.gitplex.server.git.BlobIdent;
import com.gitplex.server.git.GitUtils;
@@ -68,6 +68,7 @@ import com.gitplex.server.manager.CodeCommentManager;
import com.gitplex.server.model.CodeComment;
import com.gitplex.server.model.Project;
import com.gitplex.server.model.PullRequest;
+import com.gitplex.server.model.User;
import com.gitplex.server.model.support.CompareContext;
import com.gitplex.server.model.support.MarkPos;
import com.gitplex.server.model.support.ProjectAndRevision;
@@ -434,7 +435,22 @@ public class SourceViewPanel extends BlobViewPanel implements Markable, SearchMe
String autosaveKey = "autosave:addCodeCommentOnSource:" + context.getProject().getId()
+ ":" + context.getBlobIdent().path;
CommentInput contentInput;
- form.add(contentInput = new CommentInput("content", Model.of(""), true) {
+
+ StringBuilder mentions = new StringBuilder();
+
+ if (context.getPullRequest() == null) {
+ /*
+ * Outside of pull request, no one will be notified of the comment. So we automatically
+ * mention authors of commented lines
+ */
+ Range range = new Range(mark.getBeginLine(), mark.getEndLine());
+ for (User user: context.getProject().getAuthors(context.getBlobIdent().path, context.getCommit(), range)) {
+ if (user.getEmail() != null)
+ mentions.append("@").append(user.getName()).append(" ");
+ }
+ }
+
+ form.add(contentInput = new CommentInput("content", Model.of(mentions.toString()), true) {
@Override
protected ProjectAttachmentSupport getAttachmentSupport() {
@@ -819,7 +835,7 @@ public class SourceViewPanel extends BlobViewPanel implements Markable, SearchMe
BlameCommand cmd = new BlameCommand(context.getProject().getGitDir());
cmd.commitHash(commitHash).file(context.getBlobIdent().path);
- for (Blame blame: cmd.call().values()) {
+ for (BlameBlock blame: cmd.call()) {
BlameInfo blameInfo = new BlameInfo();
blameInfo.commitDate = DateUtils.formatDate(blame.getCommit().getCommitter().getWhen());
blameInfo.authorName = HtmlEscape.escapeHtml5(blame.getCommit().getAuthor().getName());
diff --git a/web/src/main/java/com/gitplex/server/web/page/project/blob/render/renderers/source/source-view.js b/web/src/main/java/com/gitplex/server/web/page/project/blob/render/renderers/source/source-view.js
index 822bc05acb..25c178a095 100644
--- a/web/src/main/java/com/gitplex/server/web/page/project/blob/render/renderers/source/source-view.js
+++ b/web/src/main/java/com/gitplex/server/web/page/project/blob/render/renderers/source/source-view.js
@@ -548,7 +548,7 @@ gitplex.server.sourceView = {
$gutter.append("<span class='author'>" + blameInfo.authorName + "</span>");
cm.setGutterMarker(range.from, "CodeMirror-annotations", $gutter[0]);
- for (var line = range.from+1; line<range.to; line++) {
+ for (var line = range.from+1; line<=range.to; line++) {
var $gutter = $(document.createElement("div"));
$gutter.addClass("CodeMirror-annotation");
$gutter.append("<span class='same-as-above'>...</span>");