summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2012-11-06 17:47:52 -0500
committerJames Moger <james.moger@gitblit.com>2012-11-06 17:47:52 -0500
commit798581cab5817310a1b9991dac3b10cd7813f86a (patch)
tree156e4570f18aa4e373d6506f161816dd2b517f5a
parent618d1691dc0003c8243942354d81dd35a195a94e (diff)
downloadgitblit-798581cab5817310a1b9991dac3b10cd7813f86a.tar.gz
gitblit-798581cab5817310a1b9991dac3b10cd7813f86a.zip
Added setting to control length of abbreviated commit hash id
-rw-r--r--distrib/gitblit.properties5
-rw-r--r--docs/04_releases.mkd2
-rw-r--r--groovy/sendmail-html.groovy4
-rw-r--r--src/com/gitblit/wicket/pages/RepositoryPage.java2
4 files changed, 11 insertions, 2 deletions
diff --git a/distrib/gitblit.properties b/distrib/gitblit.properties
index 60b1a897..1a5a61b3 100644
--- a/distrib/gitblit.properties
+++ b/distrib/gitblit.properties
@@ -469,6 +469,11 @@ web.allowZipDownloads = true
# SINCE 0.9.0
web.allowLuceneIndexing = true
+# Controls the length of shortened commit hash ids
+#
+# SINCE 1.2.0
+web.shortCommitIdLength = 8
+
# Use Clippy (Flash solution) to provide a copy-to-clipboard button.
# If false, a button with a more primitive JavaScript-based prompt box will
# offer a 3-step (click, ctrl+c, enter) copy-to-clipboard alternative.
diff --git a/docs/04_releases.mkd b/docs/04_releases.mkd
index f0470e5c..a8813c50 100644
--- a/docs/04_releases.mkd
+++ b/docs/04_releases.mkd
@@ -46,6 +46,8 @@ In order to fork a repository, the user account must have the *fork* permission
**New:** *git.garbageCollectionHour = 0*
**New:** *git.defaultGarbageCollectionThreshold = 500k*
**New:** *git.defaultGarbageCollectionPeriod = 7 days*
+- Added setting to control length of shortened commit ids
+ **New:** *web.shortCommitIdLength=8*
- Added simple project pages. A project is a subfolder off the *git.repositoriesFolder*.
- Added support for X-Forwarded-Context for Apache subdomain proxy configurations (issue 135)
- Delete branch feature (issue 121, Github/ajermakovics)
diff --git a/groovy/sendmail-html.groovy b/groovy/sendmail-html.groovy
index 72de106e..c3b551d5 100644
--- a/groovy/sendmail-html.groovy
+++ b/groovy/sendmail-html.groovy
@@ -154,6 +154,7 @@ class HtmlMailWriter {
def mountParameters
def forwardSlashChar
def includeGravatar
+ def shortCommitIdLength
def commitCount = 0
def commands
def writer = new StringWriter();
@@ -256,7 +257,7 @@ class HtmlMailWriter {
}
def writeCommit(commit) {
- def abbreviated = repository.newObjectReader().abbreviate(commit.id, 8).name()
+ def abbreviated = repository.newObjectReader().abbreviate(commit.id, shortCommitIdLength).name()
def author = commit.authorIdent.name
def email = commit.authorIdent.emailAddress
def message = commit.shortMessage
@@ -482,6 +483,7 @@ mailWriter.commands = commands
mailWriter.url = url
mailWriter.mountParameters = gitblit.getBoolean(Keys.web.mountParameters, true)
mailWriter.includeGravatar = gitblit.getBoolean(Keys.web.allowGravatar, true)
+mailWriter.shortCommitIdLength = GitBlit.getInteger(Keys.web.shortCommitIdLength, 8)
def content = mailWriter.write()
diff --git a/src/com/gitblit/wicket/pages/RepositoryPage.java b/src/com/gitblit/wicket/pages/RepositoryPage.java
index 2bd1ec26..0a399850 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, 8);
+ return objectId.substring(0, GitBlit.getInteger(Keys.web.shortCommitIdLength, 8));
}
protected void addRefs(Repository r, RevCommit c) {