Skip to content

The Unified and Autonomous Development Platform

Fix blame inaccurate issue.

Robin Shenb9583769adf5
diff --git a/commons.git/src/main/java/com/pmease/commons/git/command/BlameCommand.java b/commons.git/src/main/java/com/pmease/commons/git/command/BlameCommand.java
index 55e4306f05..e3ec57f27d 100644
--- a/commons.git/src/main/java/com/pmease/commons/git/command/BlameCommand.java
+++ b/commons.git/src/main/java/com/pmease/commons/git/command/BlameCommand.java
@@ -27,7 +27,7 @@ public class BlameCommand extends GitCommand<Map<String, Blame>> {
private static final Logger logger = LoggerFactory.getLogger(BlameCommand.class);
- private static final ReferenceMap cache = new ReferenceMap(AbstractReferenceMap.HARD, AbstractReferenceMap.WEAK);
+ private static final ReferenceMap cache = new ReferenceMap(AbstractReferenceMap.HARD, AbstractReferenceMap.SOFT);
private static final int CACHE_THRESHOLD = 1000;
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/blobview/source/source-view.js b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/blobview/source/source-view.js
index 6852d95901..6b1c1e17c3 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/blobview/source/source-view.js
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/blobview/source/source-view.js
@@ -146,14 +146,13 @@ gitplex.sourceview = {
cm.setOption("gutters", ["CodeMirror-annotations", "CodeMirror-linenumbers", "CodeMirror-foldgutter"]);
for (var i in blames) {
var blame = blames[i];
- var $ele = $(document.createElement("div"));
- $ele.addClass("CodeMirror-annotation");
- $("<a class='hash'>" + blame.hash + "</a>").appendTo($ele).attr("href", blame.url).attr("title", blame.message);
- $ele.append("<span class='date'>" + blame.authorDate + "</span>");
- $ele.append("<span class='author'>" + blame.authorName + "</span>");
for (var j in blame.ranges) {
- var range = blame.ranges[j];
- cm.setGutterMarker(range.beginLine, "CodeMirror-annotations", $ele[0]);
+ var $ele = $(document.createElement("div"));
+ $ele.addClass("CodeMirror-annotation");
+ $("<a class='hash'>" + blame.hash + "</a>").appendTo($ele).attr("href", blame.url).attr("title", blame.message);
+ $ele.append("<span class='date'>" + blame.authorDate + "</span>");
+ $ele.append("<span class='author'>" + blame.authorName + "</span>");
+ cm.setGutterMarker(blame.ranges[j].beginLine, "CodeMirror-annotations", $ele[0]);
}
}
} else {
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/file/RepoFilePage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/file/RepoFilePage.java
index 8ecd0f355f..81ee697476 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/file/RepoFilePage.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/file/RepoFilePage.java
@@ -488,6 +488,7 @@ public class RepoFilePage extends RepositoryPage {
protected void onSelect(AjaxRequestTarget target, QueryHit hit) {
file = new BlobIdent(file.revision, hit.getBlobPath(), FileMode.REGULAR_FILE.getBits());
tokenPos = hit.getTokenPos();
+ blame = false;
newFileNavigator(target);
newFileViewer(target);