Skip to content

The Unified and Autonomous Development Platform

midwork

robin shine2a9db95c25d3
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/revision/RevisionDiffPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/revision/RevisionDiffPanel.java
index c698cee803..cec154fb66 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/revision/RevisionDiffPanel.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/revision/RevisionDiffPanel.java
@@ -95,7 +95,17 @@ public abstract class RevisionDiffPanel extends Panel {
diffEntries = repoModel.getObject().getDiffs(oldCommitHash, newCommitHash, true);
for (Iterator<DiffEntry> it = diffEntries.iterator(); it.hasNext();) {
DiffEntry entry = it.next();
- if (!path.equals(entry.getOldPath()) && !path.equals(entry.getNewPath()))
+ boolean oldPathMatches = false;
+ if (entry.getOldPath() != null && entry.getOldPath().startsWith(path)) {
+ String subpath = entry.getOldPath().substring(path.length());
+ oldPathMatches = subpath.length() == 0 || subpath.charAt(0) == '/';
+ }
+ boolean newPathMatches = false;
+ if (entry.getNewPath() != null && entry.getNewPath().startsWith(path)) {
+ String subpath = entry.getNewPath().substring(path.length());
+ newPathMatches = subpath.length() == 0 || subpath.charAt(0) == '/';
+ }
+ if (!oldPathMatches && !newPathMatches)
it.remove();
}
}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/compare/RevisionComparePage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/compare/RevisionComparePage.java
index 44c5412e7e..1c0fc47b35 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/compare/RevisionComparePage.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/compare/RevisionComparePage.java
@@ -341,7 +341,7 @@ public class RevisionComparePage extends RepositoryPage {
return RevisionComparePage.this.getRepository();
}
- }, RevisionComparePage.this.target.getRevision()) {
+ }, RevisionComparePage.this.source.getRevision()) {
@Override
protected void onSelectPath(AjaxRequestTarget target, String path) {