From: James Moger Date: Mon, 5 Mar 2012 21:33:46 +0000 (-0500) Subject: Not all GitNotes were displayed on the commit page (issue 70) X-Git-Tag: v0.9.0~72 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9357e929bdc1237577b6f6302861dce0e9d1e39c;p=gitblit.git Not all GitNotes were displayed on the commit page (issue 70) --- diff --git a/docs/04_releases.mkd b/docs/04_releases.mkd index fed78166..b2d0c776 100644 --- a/docs/04_releases.mkd +++ b/docs/04_releases.mkd @@ -31,6 +31,7 @@ Push requests to these repositories will be rejected. #### fixes - Uppercase repositories not selectable in edit palettes (issue 71) +- Not all git notes were properly displayed on the commit page (issue 70) - Activity page now displays all local branches (issue 65) - Fixed (harmless) nullpointer on pushing to an empty repository (issue 69) - Fixed possible nullpointer from the servlet container on startup (issue 67) 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