From 9357e929bdc1237577b6f6302861dce0e9d1e39c Mon Sep 17 00:00:00 2001 From: James Moger Date: Mon, 5 Mar 2012 16:33:46 -0500 Subject: Not all GitNotes were displayed on the commit page (issue 70) --- src/com/gitblit/utils/JGitUtils.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/com/gitblit/utils') diff --git a/src/com/gitblit/utils/JGitUtils.java b/src/com/gitblit/utils/JGitUtils.java index 5f193d02..c39ab715 100644 --- a/src/com/gitblit/utils/JGitUtils.java +++ b/src/com/gitblit/utils/JGitUtils.java @@ -1453,10 +1453,23 @@ public class JGitUtils { List noteBranches = getNoteBranches(repository, true, -1); for (RefModel notesRef : noteBranches) { RevTree notesTree = JGitUtils.getCommit(repository, notesRef.getName()).getTree(); + // flat notes list + String notePath = commit.getName(); + String text = getStringContent(repository, notesTree, notePath); + if (!StringUtils.isEmpty(text)) { + List history = getRevLog(repository, notesRef.getName(), notePath, 0, -1); + RefModel noteRef = new RefModel(notesRef.displayName, null, history.get(history + .size() - 1)); + GitNote gitNote = new GitNote(noteRef, text); + list.add(gitNote); + continue; + } + + // folder structure StringBuilder sb = new StringBuilder(commit.getName()); sb.insert(2, '/'); - String notePath = sb.toString(); - String text = getStringContent(repository, notesTree, notePath); + notePath = sb.toString(); + text = getStringContent(repository, notesTree, notePath); if (!StringUtils.isEmpty(text)) { List history = getRevLog(repository, notesRef.getName(), notePath, 0, -1); RefModel noteRef = new RefModel(notesRef.displayName, null, history.get(history -- cgit v1.2.3