From: James Moger Date: Tue, 27 Nov 2012 21:58:14 +0000 (-0500) Subject: Make activity page respect short commit id setting and lower default from 8 to 6 X-Git-Tag: v1.2.0~73 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e627cfcaa9c567849cf11759260803ae380a034e;p=gitblit.git Make activity page respect short commit id setting and lower default from 8 to 6 --- diff --git a/distrib/gitblit.properties b/distrib/gitblit.properties index 65e19ed4..b830bd57 100644 --- a/distrib/gitblit.properties +++ b/distrib/gitblit.properties @@ -494,7 +494,7 @@ web.allowLuceneIndexing = true # Controls the length of shortened commit hash ids # # SINCE 1.2.0 -web.shortCommitIdLength = 8 +web.shortCommitIdLength = 6 # Use Clippy (Flash solution) to provide a copy-to-clipboard button. # If false, a button with a more primitive JavaScript-based prompt box will diff --git a/src/com/gitblit/wicket/pages/RepositoryPage.java b/src/com/gitblit/wicket/pages/RepositoryPage.java index 0a399850..c90e3530 100644 --- a/src/com/gitblit/wicket/pages/RepositoryPage.java +++ b/src/com/gitblit/wicket/pages/RepositoryPage.java @@ -425,7 +425,7 @@ public abstract class RepositoryPage extends BasePage { } protected String getShortObjectId(String objectId) { - return objectId.substring(0, GitBlit.getInteger(Keys.web.shortCommitIdLength, 8)); + return objectId.substring(0, GitBlit.getInteger(Keys.web.shortCommitIdLength, 6)); } protected void addRefs(Repository r, RevCommit c) { diff --git a/src/com/gitblit/wicket/panels/ActivityPanel.java b/src/com/gitblit/wicket/panels/ActivityPanel.java index 2e70a9a0..9a123d8e 100644 --- a/src/com/gitblit/wicket/panels/ActivityPanel.java +++ b/src/com/gitblit/wicket/panels/ActivityPanel.java @@ -24,6 +24,8 @@ import org.apache.wicket.markup.repeater.data.DataView; import org.apache.wicket.markup.repeater.data.ListDataProvider; import com.gitblit.Constants; +import com.gitblit.GitBlit; +import com.gitblit.Keys; import com.gitblit.models.Activity; import com.gitblit.models.Activity.RepositoryCommit; import com.gitblit.utils.StringUtils; @@ -50,6 +52,7 @@ public class ActivityPanel extends BasePanel { Collections.sort(recentActivity); + final int shortHashLen = GitBlit.getInteger(Keys.web.shortCommitIdLength, 6); DataView activityView = new DataView("activity", new ListDataProvider(recentActivity)) { private static final long serialVersionUID = 1L; @@ -105,7 +108,7 @@ public class ActivityPanel extends BasePanel { commitItem.add(branchLink); LinkPanel commitid = new LinkPanel("commitid", "list subject", - commit.getShortName(), CommitPage.class, + commit.getName().substring(0, shortHashLen), CommitPage.class, WicketUtils.newObjectParameter(commit.repository, commit.getName()), true); commitItem.add(commitid);