]> source.dussan.org Git - gitblit.git/commitdiff
Use author date to be consistent with other tools (fixes #919)
authorJames Moger <james.moger@gitblit.com>
Fri, 18 Sep 2015 15:23:42 +0000 (11:23 -0400)
committerJames Moger <james.moger@gitblit.com>
Fri, 18 Sep 2015 15:23:42 +0000 (11:23 -0400)
releases.moxie
src/main/java/com/gitblit/models/RefModel.java
src/main/java/com/gitblit/utils/JGitUtils.java
src/main/java/com/gitblit/utils/MetricUtils.java
src/main/java/com/gitblit/wicket/pages/TicketPage.java
src/main/java/com/gitblit/wicket/panels/HistoryPanel.java
src/main/java/com/gitblit/wicket/panels/LogPanel.java
src/main/java/com/gitblit/wicket/panels/SearchPanel.java

index 667154df36f2a46dce3653b4c591c7dc72863a64..5fdb64ca6cd96df9190579eb8179815026d9ff10 100644 (file)
@@ -24,6 +24,7 @@ r27: {
     - Use release name as root directory in Gitblit GO artifacts (ticket-109)
     - Split gitblit.properties into gitblit.properties & defaults.properties (ticket-110)
     - Show team type in teams page (pr-217, ticket-168)
+    - Use author date to be consistent with other tools (pr-919)
     additions:
     - Add GitHub Octicons (ticket-106)
     - Support for chain-loading properties files (ticket-110) 
index 02ba1302b3ba79eaeff60cea0266ff13ccf55713..4d9a0c659587b94553c43ac8f4b66dab36b666b2 100644 (file)
@@ -58,9 +58,9 @@ public class RefModel implements Serializable, Comparable<RefModel> {
                                }\r
                        } else if (referencedObject instanceof RevCommit) {\r
                                RevCommit commit = (RevCommit) referencedObject;\r
-                               PersonIdent committer = commit.getCommitterIdent();\r
-                               if (committer != null) {\r
-                                       date = committer.getWhen();\r
+                               PersonIdent author = commit.getAuthorIdent();\r
+                               if (author != null) {\r
+                                       date = author.getWhen();\r
                                } else {\r
                                        date = JGitUtils.getCommitDate(commit);\r
                                }\r
index 356a796c71c74d94ad5558fa3136c908762cccc7..c3d020738fb6978bf7c50b59d0c297bf4748556a 100644 (file)
@@ -30,7 +30,6 @@ import java.util.Map;
 import java.util.Map.Entry;\r
 import java.util.regex.Pattern;\r
 \r
-import com.google.common.base.Strings;\r
 import org.apache.commons.io.filefilter.TrueFileFilter;\r
 import org.eclipse.jgit.api.CloneCommand;\r
 import org.eclipse.jgit.api.FetchCommand;\r
@@ -91,6 +90,7 @@ import com.gitblit.models.PathModel;
 import com.gitblit.models.PathModel.PathChangeModel;\r
 import com.gitblit.models.RefModel;\r
 import com.gitblit.models.SubmoduleModel;\r
+import com.google.common.base.Strings;\r
 \r
 /**\r
  * Collection of static methods for retrieving information from a repository.\r
@@ -691,7 +691,10 @@ public class JGitUtils {
                if (commit == null) {\r
                        return new Date(0);\r
                }\r
-               return commit.getAuthorIdent().getWhen();\r
+               if (commit.getAuthorIdent() != null) {\r
+                       return commit.getAuthorIdent().getWhen();\r
+               }\r
+               return getCommitDate(commit);\r
        }\r
 \r
        /**\r
index 470310212aa22c80825d677bf5af33d0844aa575..62427e6d5aee431c53f78318676b41fa2806bb18 100644 (file)
@@ -136,7 +136,7 @@ public class MetricUtils {
 \r
                                Iterable<RevCommit> revlog = revWalk;\r
                                for (RevCommit rev : revlog) {\r
-                                       Date d = JGitUtils.getCommitDate(rev);\r
+                                       Date d = JGitUtils.getAuthorDate(rev);\r
                                        String p = df.format(d);\r
                                        if (!metricMap.containsKey(p)) {\r
                                                metricMap.put(p, new Metric(p));\r
index 2dbc8e9d27b35c13c62436f7da52a6367eb92143..8bf5c6d98b2aaa0918f34482401ec7f0df2cc70c 100644 (file)
@@ -88,10 +88,10 @@ import com.gitblit.utils.TimeUtils;
 import com.gitblit.wicket.GitBlitWebSession;\r
 import com.gitblit.wicket.TicketsUI;\r
 import com.gitblit.wicket.WicketUtils;\r
+import com.gitblit.wicket.panels.AvatarImage;\r
 import com.gitblit.wicket.panels.BasePanel.JavascriptTextPrompt;\r
 import com.gitblit.wicket.panels.CommentPanel;\r
 import com.gitblit.wicket.panels.DiffStatPanel;\r
-import com.gitblit.wicket.panels.AvatarImage;\r
 import com.gitblit.wicket.panels.IconAjaxLink;\r
 import com.gitblit.wicket.panels.LinkPanel;\r
 import com.gitblit.wicket.panels.ShockWaveComponent;\r
@@ -823,7 +823,7 @@ public class TicketPage extends RepositoryPage {
                                        item.add(new LinkPanel("diff", "link", getString("gb.diff"), CommitDiffPage.class,\r
                                                        WicketUtils.newObjectParameter(repositoryName, commit.getName()), true));\r
                                        item.add(new Label("title", StringUtils.trimString(commit.getShortMessage(), Constants.LEN_SHORTLOG_REFS)));\r
-                                       item.add(WicketUtils.createDateLabel("commitDate", JGitUtils.getCommitDate(commit), GitBlitWebSession\r
+                                       item.add(WicketUtils.createDateLabel("commitDate", JGitUtils.getAuthorDate(commit), GitBlitWebSession\r
                                                        .get().getTimezone(), getTimeUtils(), false));\r
                                        item.add(new DiffStatPanel("commitDiffStat", 0, 0, true));\r
                                }\r
index 5233f7c9360a406f24c759fbd21dd3172529317a..a3f127b1feb1896a67812382e1adef15787b2205 100644 (file)
@@ -160,7 +160,7 @@ public class HistoryPanel extends BasePanel {
                        @Override\r
                        public void populateItem(final Item<RevCommit> item) {\r
                                final RevCommit entry = item.getModelObject();\r
-                               final Date date = JGitUtils.getCommitDate(entry);\r
+                               final Date date = JGitUtils.getAuthorDate(entry);\r
 \r
                                item.add(WicketUtils.createDateLabel("commitDate", date, getTimeZone(), getTimeUtils()));\r
 \r
index 16fc746e40dda8a0e8f7913a307d6db3b1a6b8a0..e9d240d09fbf219da6826e438c0d93194b60d288 100644 (file)
@@ -109,7 +109,7 @@ public class LogPanel extends BasePanel {
                        @Override\r
                        public void populateItem(final Item<RevCommit> item) {\r
                                final RevCommit entry = item.getModelObject();\r
-                               final Date date = JGitUtils.getCommitDate(entry);\r
+                               final Date date = JGitUtils.getAuthorDate(entry);\r
                                final boolean isMerge = entry.getParentCount() > 1;\r
 \r
                                item.add(WicketUtils.createDateLabel("commitDate", date, getTimeZone(), getTimeUtils()));\r
index 5d0b2de14252d5b358f0c58d19ff14f87948d8dd..09322bc75cb699e64a0530b91837a9067a43876d 100644 (file)
@@ -86,7 +86,7 @@ public class SearchPanel extends BasePanel {
                        @Override\r
                        public void populateItem(final Item<RevCommit> item) {\r
                                final RevCommit entry = item.getModelObject();\r
-                               final Date date = JGitUtils.getCommitDate(entry);\r
+                               final Date date = JGitUtils.getAuthorDate(entry);\r
 \r
                                item.add(WicketUtils.createDateLabel("commitDate", date, getTimeZone(), getTimeUtils()));\r
 \r