From e11f48115c93229700b7504450b324bdcf644fb2 Mon Sep 17 00:00:00 2001 From: James Moger Date: Mon, 17 Oct 2011 17:46:27 -0400 Subject: [PATCH] Handle the earliest tags from the Linux kernel repository (issue 25) --- docs/00_index.mkd | 3 ++- docs/04_releases.mkd | 3 ++- src/com/gitblit/models/RefModel.java | 6 ++++- .../gitblit/wicket/pages/RepositoryPage.java | 25 +++++++++---------- src/com/gitblit/wicket/pages/TagPage.java | 8 ++++-- 5 files changed, 27 insertions(+), 18 deletions(-) diff --git a/docs/00_index.mkd b/docs/00_index.mkd index 746402e7..ee5faafb 100644 --- a/docs/00_index.mkd +++ b/docs/00_index.mkd @@ -38,7 +38,8 @@ Gitblit requires a Java 6 Runtime Environment (JRE) or a Java 6 Development Kit - added: Gitblit Manager (Java/Swing Application) for remote administration of a Gitblit server. - fixed: federation protocol timestamps. dates are now serialized to the [iso8601](http://en.wikipedia.org/wiki/ISO_8601) standard. **This breaks 0.6.0 federation clients/servers.** -- fixed: Gitblit now runs on Servlet 3.0 webservers (e.g. Tomcat 7, Jetty 8) +- fixed: Gitblit can now browse the Linux kernel repository (issue 25) +- fixed: Gitblit now runs on Servlet 3.0 webservers (e.g. Tomcat 7, Jetty 8) (issue 23) - fixed: Set the RSS content type for Firefox 4 (issue 22) - fixed: Null pointer exception if did not set federation strategy (issue 20) - fixed: Gitblit GO allows SSL renegotiation if running on Java 1.6.0_22 or later diff --git a/docs/04_releases.mkd b/docs/04_releases.mkd index bb238bbe..fad61d32 100644 --- a/docs/04_releases.mkd +++ b/docs/04_releases.mkd @@ -12,7 +12,8 @@ - added: Gitblit Manager (Java/Swing Application) for remote administration of a Gitblit server. - fixed: federation protocol timestamps. dates are now serialized to the [iso8601](http://en.wikipedia.org/wiki/ISO_8601) standard. **This breaks 0.6.0 federation clients/servers.** -- fixed: Gitblit now runs on Servlet 3.0 webservers (e.g. Tomcat 7, Jetty 8) +- fixed: Gitblit can now browse the Linux kernel repository (issue 25) +- fixed: Gitblit now runs on Servlet 3.0 webservers (e.g. Tomcat 7, Jetty 8) (issue 23) - fixed: Set the RSS content type for Firefox 4 (issue 22) - fixed: Null pointer exception if did not set federation strategy (issue 20) - fixed: Gitblit GO allows SSL renegotiation if running on Java 1.6.0_22 or later diff --git a/src/com/gitblit/models/RefModel.java b/src/com/gitblit/models/RefModel.java index fab5fc1f..acac7763 100644 --- a/src/com/gitblit/models/RefModel.java +++ b/src/com/gitblit/models/RefModel.java @@ -24,6 +24,7 @@ import org.eclipse.jgit.lib.Ref; import org.eclipse.jgit.revwalk.RevCommit; import org.eclipse.jgit.revwalk.RevObject; import org.eclipse.jgit.revwalk.RevTag; +import org.eclipse.jgit.revwalk.RevTree; /** * RefModel is a serializable model class that represents a tag or branch and @@ -49,7 +50,10 @@ public class RefModel implements Serializable, Comparable { Date date = new Date(0); if (referencedObject != null) { if (referencedObject instanceof RevTag) { - date = ((RevTag) referencedObject).getTaggerIdent().getWhen(); + RevTag tag = (RevTag) referencedObject; + if (tag.getTaggerIdent() != null) { + date = tag.getTaggerIdent().getWhen(); + } } else if (referencedObject instanceof RevCommit) { date = ((RevCommit) referencedObject).getCommitterIdent().getWhen(); } diff --git a/src/com/gitblit/wicket/pages/RepositoryPage.java b/src/com/gitblit/wicket/pages/RepositoryPage.java index 272a3f5a..2d616a49 100644 --- a/src/com/gitblit/wicket/pages/RepositoryPage.java +++ b/src/com/gitblit/wicket/pages/RepositoryPage.java @@ -207,13 +207,14 @@ public abstract class RepositoryPage extends BasePage { protected Component createPersonPanel(String wicketId, PersonIdent identity, SearchType searchType) { + String name = identity == null ? "" : identity.getName(); + String address = identity == null ? "" : identity.getEmailAddress(); boolean showEmail = GitBlit.getBoolean(Keys.web.showEmailAddresses, false); - if (!showEmail || StringUtils.isEmpty(identity.getName()) - || StringUtils.isEmpty(identity.getEmailAddress())) { - String value = identity.getName(); + if (!showEmail || StringUtils.isEmpty(name) || StringUtils.isEmpty(address)) { + String value = name; if (StringUtils.isEmpty(value)) { if (showEmail) { - value = identity.getEmailAddress(); + value = address; } else { value = getString("gb.missingUsername"); } @@ -226,17 +227,15 @@ public abstract class RepositoryPage extends BasePage { return partial; } else { Fragment fullPerson = new Fragment(wicketId, "fullPersonIdent", this); - LinkPanel nameLink = new LinkPanel("personName", "list", identity.getName(), - SearchPage.class, WicketUtils.newSearchParameter(repositoryName, objectId, - identity.getName(), searchType)); - setPersonSearchTooltip(nameLink, identity.getName(), searchType); + LinkPanel nameLink = new LinkPanel("personName", "list", name, SearchPage.class, + WicketUtils.newSearchParameter(repositoryName, objectId, name, searchType)); + setPersonSearchTooltip(nameLink, name, searchType); fullPerson.add(nameLink); - LinkPanel addressLink = new LinkPanel("personAddress", "list", "<" - + identity.getEmailAddress() + ">", SearchPage.class, - WicketUtils.newSearchParameter(repositoryName, objectId, - identity.getEmailAddress(), searchType)); - setPersonSearchTooltip(addressLink, identity.getEmailAddress(), searchType); + LinkPanel addressLink = new LinkPanel("personAddress", "list", "<" + address + ">", + SearchPage.class, WicketUtils.newSearchParameter(repositoryName, objectId, + address, searchType)); + setPersonSearchTooltip(addressLink, address, searchType); fullPerson.add(addressLink); return fullPerson; } diff --git a/src/com/gitblit/wicket/pages/TagPage.java b/src/com/gitblit/wicket/pages/TagPage.java index c1efb898..a346670e 100644 --- a/src/com/gitblit/wicket/pages/TagPage.java +++ b/src/com/gitblit/wicket/pages/TagPage.java @@ -17,6 +17,7 @@ package com.gitblit.wicket.pages; import java.text.MessageFormat; import java.util.Arrays; +import java.util.Date; import java.util.List; import org.apache.wicket.PageParameters; @@ -80,8 +81,11 @@ public class TagPage extends RepositoryPage { add(new Label("taggedObjectType", getString(typeKey))); add(createPersonPanel("tagger", tagRef.getAuthorIdent(), SearchType.AUTHOR)); - add(WicketUtils.createTimestampLabel("tagDate", tagRef.getAuthorIdent().getWhen(), - getTimeZone())); + Date when = new Date(0); + if (tagRef.getAuthorIdent() != null) { + when = tagRef.getAuthorIdent().getWhen(); + } + add(WicketUtils.createTimestampLabel("tagDate", when, getTimeZone())); addFullText("fullMessage", tagRef.getFullMessage(), true); } -- 2.39.5