diff options
author | James Moger <james.moger@gitblit.com> | 2015-09-18 11:23:42 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2015-09-18 11:23:42 -0400 |
commit | a592329a82d0a85d33abcc63f08df20b79e8e4f7 (patch) | |
tree | 2f96ec8cd71727634dd15c8da914ccdccabc9bdf /src/main/java | |
parent | 9bd0f28be7b974988630ec8facc8bcfd748afc9d (diff) | |
download | gitblit-a592329a82d0a85d33abcc63f08df20b79e8e4f7.tar.gz gitblit-a592329a82d0a85d33abcc63f08df20b79e8e4f7.zip |
Use author date to be consistent with other tools (fixes #919)
Diffstat (limited to 'src/main/java')
7 files changed, 14 insertions, 11 deletions
diff --git a/src/main/java/com/gitblit/models/RefModel.java b/src/main/java/com/gitblit/models/RefModel.java index 02ba1302..4d9a0c65 100644 --- a/src/main/java/com/gitblit/models/RefModel.java +++ b/src/main/java/com/gitblit/models/RefModel.java @@ -58,9 +58,9 @@ public class RefModel implements Serializable, Comparable<RefModel> { }
} else if (referencedObject instanceof RevCommit) {
RevCommit commit = (RevCommit) referencedObject;
- PersonIdent committer = commit.getCommitterIdent();
- if (committer != null) {
- date = committer.getWhen();
+ PersonIdent author = commit.getAuthorIdent();
+ if (author != null) {
+ date = author.getWhen();
} else {
date = JGitUtils.getCommitDate(commit);
}
diff --git a/src/main/java/com/gitblit/utils/JGitUtils.java b/src/main/java/com/gitblit/utils/JGitUtils.java index 356a796c..c3d02073 100644 --- a/src/main/java/com/gitblit/utils/JGitUtils.java +++ b/src/main/java/com/gitblit/utils/JGitUtils.java @@ -30,7 +30,6 @@ import java.util.Map; import java.util.Map.Entry;
import java.util.regex.Pattern;
-import com.google.common.base.Strings;
import org.apache.commons.io.filefilter.TrueFileFilter;
import org.eclipse.jgit.api.CloneCommand;
import org.eclipse.jgit.api.FetchCommand;
@@ -91,6 +90,7 @@ import com.gitblit.models.PathModel; import com.gitblit.models.PathModel.PathChangeModel;
import com.gitblit.models.RefModel;
import com.gitblit.models.SubmoduleModel;
+import com.google.common.base.Strings;
/**
* Collection of static methods for retrieving information from a repository.
@@ -691,7 +691,10 @@ public class JGitUtils { if (commit == null) {
return new Date(0);
}
- return commit.getAuthorIdent().getWhen();
+ if (commit.getAuthorIdent() != null) {
+ return commit.getAuthorIdent().getWhen();
+ }
+ return getCommitDate(commit);
}
/**
diff --git a/src/main/java/com/gitblit/utils/MetricUtils.java b/src/main/java/com/gitblit/utils/MetricUtils.java index 47031021..62427e6d 100644 --- a/src/main/java/com/gitblit/utils/MetricUtils.java +++ b/src/main/java/com/gitblit/utils/MetricUtils.java @@ -136,7 +136,7 @@ public class MetricUtils { Iterable<RevCommit> revlog = revWalk;
for (RevCommit rev : revlog) {
- Date d = JGitUtils.getCommitDate(rev);
+ Date d = JGitUtils.getAuthorDate(rev);
String p = df.format(d);
if (!metricMap.containsKey(p)) {
metricMap.put(p, new Metric(p));
diff --git a/src/main/java/com/gitblit/wicket/pages/TicketPage.java b/src/main/java/com/gitblit/wicket/pages/TicketPage.java index 2dbc8e9d..8bf5c6d9 100644 --- a/src/main/java/com/gitblit/wicket/pages/TicketPage.java +++ b/src/main/java/com/gitblit/wicket/pages/TicketPage.java @@ -88,10 +88,10 @@ import com.gitblit.utils.TimeUtils; import com.gitblit.wicket.GitBlitWebSession;
import com.gitblit.wicket.TicketsUI;
import com.gitblit.wicket.WicketUtils;
+import com.gitblit.wicket.panels.AvatarImage;
import com.gitblit.wicket.panels.BasePanel.JavascriptTextPrompt;
import com.gitblit.wicket.panels.CommentPanel;
import com.gitblit.wicket.panels.DiffStatPanel;
-import com.gitblit.wicket.panels.AvatarImage;
import com.gitblit.wicket.panels.IconAjaxLink;
import com.gitblit.wicket.panels.LinkPanel;
import com.gitblit.wicket.panels.ShockWaveComponent;
@@ -823,7 +823,7 @@ public class TicketPage extends RepositoryPage { item.add(new LinkPanel("diff", "link", getString("gb.diff"), CommitDiffPage.class,
WicketUtils.newObjectParameter(repositoryName, commit.getName()), true));
item.add(new Label("title", StringUtils.trimString(commit.getShortMessage(), Constants.LEN_SHORTLOG_REFS)));
- item.add(WicketUtils.createDateLabel("commitDate", JGitUtils.getCommitDate(commit), GitBlitWebSession
+ item.add(WicketUtils.createDateLabel("commitDate", JGitUtils.getAuthorDate(commit), GitBlitWebSession
.get().getTimezone(), getTimeUtils(), false));
item.add(new DiffStatPanel("commitDiffStat", 0, 0, true));
}
diff --git a/src/main/java/com/gitblit/wicket/panels/HistoryPanel.java b/src/main/java/com/gitblit/wicket/panels/HistoryPanel.java index 5233f7c9..a3f127b1 100644 --- a/src/main/java/com/gitblit/wicket/panels/HistoryPanel.java +++ b/src/main/java/com/gitblit/wicket/panels/HistoryPanel.java @@ -160,7 +160,7 @@ public class HistoryPanel extends BasePanel { @Override
public void populateItem(final Item<RevCommit> item) {
final RevCommit entry = item.getModelObject();
- final Date date = JGitUtils.getCommitDate(entry);
+ final Date date = JGitUtils.getAuthorDate(entry);
item.add(WicketUtils.createDateLabel("commitDate", date, getTimeZone(), getTimeUtils()));
diff --git a/src/main/java/com/gitblit/wicket/panels/LogPanel.java b/src/main/java/com/gitblit/wicket/panels/LogPanel.java index 16fc746e..e9d240d0 100644 --- a/src/main/java/com/gitblit/wicket/panels/LogPanel.java +++ b/src/main/java/com/gitblit/wicket/panels/LogPanel.java @@ -109,7 +109,7 @@ public class LogPanel extends BasePanel { @Override
public void populateItem(final Item<RevCommit> item) {
final RevCommit entry = item.getModelObject();
- final Date date = JGitUtils.getCommitDate(entry);
+ final Date date = JGitUtils.getAuthorDate(entry);
final boolean isMerge = entry.getParentCount() > 1;
item.add(WicketUtils.createDateLabel("commitDate", date, getTimeZone(), getTimeUtils()));
diff --git a/src/main/java/com/gitblit/wicket/panels/SearchPanel.java b/src/main/java/com/gitblit/wicket/panels/SearchPanel.java index 5d0b2de1..09322bc7 100644 --- a/src/main/java/com/gitblit/wicket/panels/SearchPanel.java +++ b/src/main/java/com/gitblit/wicket/panels/SearchPanel.java @@ -86,7 +86,7 @@ public class SearchPanel extends BasePanel { @Override
public void populateItem(final Item<RevCommit> item) {
final RevCommit entry = item.getModelObject();
- final Date date = JGitUtils.getCommitDate(entry);
+ final Date date = JGitUtils.getAuthorDate(entry);
item.add(WicketUtils.createDateLabel("commitDate", date, getTimeZone(), getTimeUtils()));
|