Skip to content

The Unified and Autonomous Development Platform

Small change for blob

steve9c7f8da98ac0
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/blob/SourceBlobPanel.java b/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/blob/SourceBlobPanel.java
index 32aaa65586..6bdaebf857 100644
--- a/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/blob/SourceBlobPanel.java
+++ b/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/blob/SourceBlobPanel.java
@@ -88,7 +88,7 @@ public class SourceBlobPanel extends AbstractSourcePagePanel {
List<String> lines = getBlob().getLines();
int sloc = 0;
for (String each : lines) {
- if (!StringUtils.isEmpty(each.trim())) {
+ if (!StringUtils.isBlank(each)) {
sloc++;
}
}
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/tree/SourceTreePanel.html b/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/tree/SourceTreePanel.html
index bfa4e8edf1..95c32d11ab 100644
--- a/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/tree/SourceTreePanel.html
+++ b/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/tree/SourceTreePanel.html
@@ -35,8 +35,8 @@
<tr wicket:id="files">
<td class="file-icon"><i class="" wicket:id="icon"></i></td>
<td class="file-name"><a wicket:id="file"><span wicket:id="name"></span></a></td>
- <td class="message">[TODO] Retrieve the last commit message</td>
- <td class="age">[TODO] 24 days ago</td>
+ <td class="message"></td>
+ <td class="age"></td>
</tr>
</table>
</section>
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/tree/SourceTreePanel.java b/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/tree/SourceTreePanel.java
index 88953abdb3..ff21544be9 100644
--- a/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/tree/SourceTreePanel.java
+++ b/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/tree/SourceTreePanel.java
@@ -222,6 +222,11 @@ public class SourceTreePanel extends AbstractSourcePagePanel {
link.add(new Label("name", node.getName()));
item.add(link);
+
+// Git git = getProject().code();
+// Commit commit = GitUtils.getLastCommit(git, getRevision(), path);
+// item.add(new Label("message", Model.of(commit.getSubject())));
+// item.add(new AgeLabel("age", Model.of(commit.getAuthor().getDate())));
}
};
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/util/GitUtils.java b/gitop.web/src/main/java/com/pmease/gitop/web/util/GitUtils.java
index 307028f01f..0c63bfc8ab 100644
--- a/gitop.web/src/main/java/com/pmease/gitop/web/util/GitUtils.java
+++ b/gitop.web/src/main/java/com/pmease/gitop/web/util/GitUtils.java
@@ -65,4 +65,9 @@ public class GitUtils {
return ref.getName().substring(Constants.R_HEADS.length());
}
}
+
+ public static @Nullable Commit getLastCommit(Git git, String revision, String path) {
+ List<Commit> commits = git.log(null, revision, path, 1);
+ return Iterables.getFirst(commits, null);
+ }
}