]> source.dussan.org Git - gitblit.git/commitdiff
Added setting to control length of abbreviated commit hash id
authorJames Moger <james.moger@gitblit.com>
Tue, 6 Nov 2012 22:47:52 +0000 (17:47 -0500)
committerJames Moger <james.moger@gitblit.com>
Tue, 6 Nov 2012 22:47:52 +0000 (17:47 -0500)
distrib/gitblit.properties
docs/04_releases.mkd
groovy/sendmail-html.groovy
src/com/gitblit/wicket/pages/RepositoryPage.java

index 60b1a897db6e24012ea745a0e78e5cddb56d35e4..1a5a61b3dc63324f8772e741c202eb0d44007f6b 100644 (file)
@@ -469,6 +469,11 @@ web.allowZipDownloads = true
 # SINCE 0.9.0\r
 web.allowLuceneIndexing = true\r
 \r
+# Controls the length of shortened commit hash ids\r
+#\r
+# SINCE 1.2.0\r
+web.shortCommitIdLength = 8\r
+\r
 # Use Clippy (Flash solution) to provide a copy-to-clipboard button.\r
 # If false, a button with a more primitive JavaScript-based prompt box will\r
 # offer a 3-step (click, ctrl+c, enter) copy-to-clipboard alternative.\r
index f0470e5c37359d2cbd08e533e853cfdab0871690..a8813c503675a1f507c7027f498bb93bd5c8f6bc 100644 (file)
@@ -46,6 +46,8 @@ In order to fork a repository, the user account must have the *fork* permission
     **New:** *git.garbageCollectionHour = 0*  \r
     **New:** *git.defaultGarbageCollectionThreshold = 500k*  \r
     **New:** *git.defaultGarbageCollectionPeriod = 7 days*\r
+- Added setting to control length of shortened commit ids  \r
+    **New:** *web.shortCommitIdLength=8*  \r
 - Added simple project pages.  A project is a subfolder off the *git.repositoriesFolder*.\r
 - Added support for X-Forwarded-Context for Apache subdomain proxy configurations (issue 135)\r
 - Delete branch feature (issue 121, Github/ajermakovics)\r
index 72de106e3ffe4987fb756ed9bad021d7ace537bf..c3b551d5c506ddd7808e9da871a246deb119e71c 100644 (file)
@@ -154,6 +154,7 @@ class HtmlMailWriter {
     def mountParameters\r
        def forwardSlashChar\r
        def includeGravatar\r
+       def shortCommitIdLength\r
     def commitCount = 0\r
     def commands\r
     def writer = new StringWriter();\r
@@ -256,7 +257,7 @@ class HtmlMailWriter {
     }\r
 \r
     def writeCommit(commit) {\r
-        def abbreviated = repository.newObjectReader().abbreviate(commit.id, 8).name()\r
+        def abbreviated = repository.newObjectReader().abbreviate(commit.id, shortCommitIdLength).name()\r
         def author = commit.authorIdent.name\r
         def email = commit.authorIdent.emailAddress\r
         def message = commit.shortMessage\r
@@ -482,6 +483,7 @@ mailWriter.commands = commands
 mailWriter.url = url\r
 mailWriter.mountParameters = gitblit.getBoolean(Keys.web.mountParameters, true)\r
 mailWriter.includeGravatar = gitblit.getBoolean(Keys.web.allowGravatar, true)\r
+mailWriter.shortCommitIdLength = GitBlit.getInteger(Keys.web.shortCommitIdLength, 8)\r
 \r
 def content = mailWriter.write()\r
 \r
index 2bd1ec26e76a2e44ea9b4074d3c177118eaaae06..0a3998509f9f07cbd6c036dd0386c4963dd78d1f 100644 (file)
@@ -425,7 +425,7 @@ public abstract class RepositoryPage extends BasePage {
        }\r
 \r
        protected String getShortObjectId(String objectId) {\r
-               return objectId.substring(0, 8);\r
+               return objectId.substring(0, GitBlit.getInteger(Keys.web.shortCommitIdLength, 8));\r
        }\r
 \r
        protected void addRefs(Repository r, RevCommit c) {\r