]> source.dussan.org Git - gitblit.git/commitdiff
Workaround incomplete blame commit dara (issue-254)
authorJames Moger <james.moger@gitblit.com>
Wed, 12 Jun 2013 21:18:11 +0000 (17:18 -0400)
committerJames Moger <james.moger@gitblit.com>
Wed, 12 Jun 2013 21:18:11 +0000 (17:18 -0400)
releases.moxie
src/main/java/com/gitblit/models/AnnotatedLine.java
src/main/java/com/gitblit/wicket/pages/BlamePage.java

index 197013ac89b7881336592961f54e875ca16ccb13..f419992e64357faac7d37c041022fad64a05b10e 100644 (file)
@@ -28,7 +28,9 @@ r17: {
         - Ensure Redmine url is properly formatted (issue 223)\r
         - Use standard ServletRequestWrapper instead of custom wrapper (issue 224)\r
         - Switch commit message back to a pre and ensure that it is properly escaped when combined with commit message regex substitution (issue 242)\r
+        - Fixed AddIndexedBranch tool --branch parameter (issue 247)  \r
         - Improve NPE handling for hook script enumeration (issue-253)\r
+        - Workaround missing commit information in blame page (JGit bug 374382, issue-254) \r
 \r
        changes:\r
         - Improved error logging for servlet containers which provide a null contextFolder (issue 199)\r
@@ -82,7 +84,7 @@ r17: {
        - Lukasz Jader\r
        - Martijn Laan\r
        - Matthias Bauer\r
-       - Michaël Pailloncy\r
+       - Michal Pailloncy\r
        - Michael Schaefers\r
        - Philip Boutros\r
        - Rafael Cavazin\r
index 69b55bcdc9db77d8d742a862e5fbaa7d6895ac3f..439a3222a92ae14cb88773a60278d4bff705ec7c 100644 (file)
@@ -18,6 +18,7 @@ package com.gitblit.models;
 import java.io.Serializable;\r
 import java.util.Date;\r
 \r
+import org.eclipse.jgit.lib.ObjectId;\r
 import org.eclipse.jgit.revwalk.RevCommit;\r
 \r
 /**\r
@@ -38,9 +39,15 @@ public class AnnotatedLine implements Serializable {
        public final String data;\r
 \r
        public AnnotatedLine(RevCommit commit, int lineNumber, String data) {\r
-               this.commitId = commit.getName();\r
-               this.author = commit.getAuthorIdent().getName();\r
-               this.when = commit.getAuthorIdent().getWhen();\r
+               if (commit == null) {\r
+                       this.commitId = ObjectId.zeroId().getName();\r
+                       this.author = "?";\r
+                       this.when = new Date(0);\r
+               } else {\r
+                       this.commitId = commit.getName();\r
+                       this.author = commit.getAuthorIdent().getName();\r
+                       this.when = commit.getAuthorIdent().getWhen();\r
+               }\r
                this.lineNumber = lineNumber;\r
                this.data = data;\r
        }\r
index 74e25be0eb60fa588a1942f6099409ced00c3b3d..51489150d60f59e93e53e8272bebfb09e385c334 100644 (file)
@@ -27,6 +27,7 @@ import org.apache.wicket.markup.repeater.Item;
 import org.apache.wicket.markup.repeater.data.DataView;\r
 import org.apache.wicket.markup.repeater.data.ListDataProvider;\r
 import org.eclipse.jgit.lib.Constants;\r
+import org.eclipse.jgit.lib.ObjectId;\r
 import org.eclipse.jgit.revwalk.RevCommit;\r
 \r
 import com.gitblit.GitBlit;\r
@@ -96,6 +97,7 @@ public class BlamePage extends RepositoryPage {
                        private int count;\r
                        private String lastCommitId = "";\r
                        private boolean showInitials = true;\r
+                       private String zeroId = ObjectId.zeroId().getName();\r
 \r
                        public void populateItem(final Item<AnnotatedLine> item) {\r
                                AnnotatedLine entry = item.getModelObject();\r
@@ -105,14 +107,20 @@ public class BlamePage extends RepositoryPage {
                                if (!lastCommitId.equals(entry.commitId)) {\r
                                        lastCommitId = entry.commitId;\r
                                        count++;\r
-                                       // show the link for first line\r
-                                       LinkPanel commitLink = new LinkPanel("commit", null,\r
-                                                       getShortObjectId(entry.commitId), CommitPage.class,\r
-                                                       newCommitParameter(entry.commitId));\r
-                                       WicketUtils.setHtmlTooltip(commitLink,\r
-                                                       MessageFormat.format("{0}, {1}", entry.author, df.format(entry.when)));\r
-                                       item.add(commitLink);\r
-                                       showInitials = true;\r
+                                       if (zeroId.equals(entry.commitId)) {\r
+                                               // unknown commit\r
+                                               item.add(new Label("commit", "<?>"));\r
+                                               showInitials = false;\r
+                                       } else {\r
+                                               // show the link for first line\r
+                                               LinkPanel commitLink = new LinkPanel("commit", null,\r
+                                                               getShortObjectId(entry.commitId), CommitPage.class,\r
+                                                               newCommitParameter(entry.commitId));\r
+                                               WicketUtils.setHtmlTooltip(commitLink,\r
+                                                               MessageFormat.format("{0}, {1}", entry.author, df.format(entry.when)));\r
+                                               item.add(commitLink);\r
+                                               showInitials = true;\r
+                                       }\r
                                } else {\r
                                        if (showInitials) {\r
                                                showInitials = false;\r