Browse Source

Fixed line spacing on pushes with multiple branches

tags/v0.8.0
James Moger 12 years ago
parent
commit
5e8e7ed191
2 changed files with 10 additions and 7 deletions
  1. 7
    7
      groovy/sendmail.groovy
  2. 3
    0
      tests/com/gitblit/tests/GroovyScriptTest.java

+ 7
- 7
groovy/sendmail.groovy View File

@@ -134,22 +134,22 @@ for (command in commands) {
commitCount += commits.size()
if (commits.size() > 0) {
// new branch
changes += "$branchBreak new branch $ref created ($commits.size commits)\n$branchBreak"
changes += "\n$branchBreak new branch $ref created ($commits.size commits)\n$branchBreak"
changes += commits.collect(table).join(commitBreak)
changes += '\n'
} else if (ref.command.refName.startsWith('refs/tags/')) {
// new tag
changes += "$branchBreak new tag $ref created\n$branchBreak"
changes += "\n$branchBreak new tag $ref created\n$branchBreak"
} else if (ref.command.refName.startsWith('refs/heads/')) {
// new branch
changes += "$branchBreak new $ref branch created\n$branchBreak"
changes += "\n$branchBreak new $ref branch created\n$branchBreak"
}
break
case ReceiveCommand.Type.UPDATE:
def commits = JGitUtils.getRevLog(r, command.oldId.name, command.newId.name).reverse()
commitCount += commits.size()
// fast-forward branch commits table
changes += "$branchBreak $ref branch updated ($commits.size commits)\n$branchBreak"
changes += "\n$branchBreak $ref branch updated ($commits.size commits)\n$branchBreak"
changes += commits.collect(table).join(commitBreak)
changes += '\n'
break
@@ -157,13 +157,13 @@ for (command in commands) {
def commits = JGitUtils.getRevLog(r, command.oldId.name, command.newId.name).reverse()
commitCount += commits.size()
// non-fast-forward branch commits table
changes += "$branchBreak $ref branch updated [NON fast-forward] ($commits.size commits)\n$branchBreak"
changes += "\n$branchBreak $ref branch updated [NON fast-forward] ($commits.size commits)\n$branchBreak"
changes += commits.collect(table).join(commitBreak)
changes += '\n'
break
case ReceiveCommand.Type.DELETE:
// deleted branch/tag
changes += "$branchBreak $ref deleted\n$branchBreak"
changes += "\n$branchBreak $ref deleted\n$branchBreak"
break
default:
break
@@ -173,4 +173,4 @@ for (command in commands) {
r.close()
// tell Gitblit to send the message (Gitblit filters duplicate addresses)
gitblit.sendMail("$emailprefix $user.username pushed $commitCount commits => $repository.name", "$summaryUrl\n\n$changes", toAddresses)
gitblit.sendMail("$emailprefix $user.username pushed $commitCount commits => $repository.name", "$summaryUrl\n$changes", toAddresses)

+ 3
- 0
tests/com/gitblit/tests/GroovyScriptTest.java View File

@@ -73,6 +73,9 @@ public class GroovyScriptTest {
commands.add(new ReceiveCommand(ObjectId
.fromString("c18877690322dfc6ae3e37bb7f7085a24e94e887"), ObjectId
.fromString("3fa7c46d11b11d61f1cbadc6888be5d0eae21969"), "refs/heads/master"));
commands.add(new ReceiveCommand(ObjectId
.fromString("c18877690322dfc6ae3e37bb7f7085a24e94e887"), ObjectId
.fromString("3fa7c46d11b11d61f1cbadc6888be5d0eae21969"), "refs/heads/master2"));
RepositoryModel repository = GitBlit.self().getRepositoryModel("helloworld.git");
repository.mailingLists.add("list@helloworld.git");

Loading…
Cancel
Save