]> source.dussan.org Git - gitblit.git/commitdiff
Fix to sendmail-html for tags
authorJames Moger <james.moger@gitblit.com>
Fri, 23 Nov 2012 17:02:32 +0000 (12:02 -0500)
committerJames Moger <james.moger@gitblit.com>
Fri, 23 Nov 2012 17:02:32 +0000 (12:02 -0500)
groovy/sendmail-html.groovy

index 0076e83233980115ef9f3a2f521b6acc5ecefc57..e0cdecdb0536bd2585dcaeef647478d21e9236cb 100644 (file)
@@ -197,7 +197,11 @@ class HtmlMailWriter {
                        builder.span('class':'project') {\r
                                mkp.yield "$type "\r
                                span('class': 'repository', name )\r
-                               mkp.yield " $action ($number commits)"\r
+                               if (number > 0) {\r
+                                       mkp.yield " $action ($number commits)"\r
+                               } else {\r
+                                       mkp.yield " $action"\r
+                               }\r
                        }\r
         }\r
     }\r
@@ -234,7 +238,7 @@ class HtmlMailWriter {
 \r
     }\r
 \r
-    def writeCommitTable(commits) {\r
+    def writeCommitTable(commits, includeChangedPaths=true) {\r
         // Write commits table\r
         builder.table('class':"table table-disable-hover") {\r
             thead {\r
@@ -250,11 +254,13 @@ class HtmlMailWriter {
                 for (commit in commits) {\r
                     writeCommit(commit)\r
 \r
-                    // Write detail on that particular commit\r
-                    tr('class' : 'noborder') {\r
-                        td (colspan: includeGravatar ? 3 : 2)\r
-                        td (colspan:2) { writeStatusTable(commit) }\r
-                    }\r
+                                       if (includeChangedPaths) {\r
+                                               // Write detail on that particular commit\r
+                                               tr('class' : 'noborder') {\r
+                                                       td (colspan: includeGravatar ? 3 : 2)\r
+                                                       td (colspan:2) { writeStatusTable(commit) }\r
+                                               }\r
+                                       }\r
                 }\r
             }\r
         }\r
@@ -441,12 +447,17 @@ class HtmlMailWriter {
 \r
                     switch (command.type) {\r
                         case ReceiveCommand.Type.CREATE:\r
-                            def commits = JGitUtils.getRevLog(repository, command.oldId.name, command.newId.name).reverse()\r
-                            commitCount += commits.size()\r
-                            // new branch\r
-                            // Write header\r
-                            writeBranchTitle(refType, ref, "created", commits.size())\r
-                            writeCommitTable(commits)\r
+                                                       def commits = JGitUtils.getRevLog(repository, command.oldId.name, command.newId.name).reverse()\r
+                                                       commitCount += commits.size()\r
+                                                       if (refType == 'Branch') {\r
+                                                               // new branch\r
+                                                               writeBranchTitle(refType, ref, "created", commits.size())\r
+                                                               writeCommitTable(commits, true)\r
+                                                       } else {\r
+                                                               // new tag\r
+                                                               writeBranchTitle(refType, ref, "created", 0)\r
+                                                               writeCommitTable(commits, false)\r
+                                                       }\r
                             break\r
                         case ReceiveCommand.Type.UPDATE:\r
                             def commits = JGitUtils.getRevLog(repository, command.oldId.name, command.newId.name).reverse()\r