From 5e8e7ed191aaf72811334b4ba656405932719766 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Thu, 05 Jan 2012 17:08:22 -0500
Subject: [PATCH] Fixed line spacing on pushes with multiple branches

---
 groovy/sendmail.groovy                        |   14 +++++++-------
 tests/com/gitblit/tests/GroovyScriptTest.java |    3 +++
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/groovy/sendmail.groovy b/groovy/sendmail.groovy
index 9616909..0b60dfa 100644
--- a/groovy/sendmail.groovy
+++ b/groovy/sendmail.groovy
@@ -134,22 +134,22 @@
 			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 @@
 			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 @@
 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)
\ No newline at end of file
+gitblit.sendMail("$emailprefix $user.username pushed $commitCount commits => $repository.name", "$summaryUrl\n$changes", toAddresses)
\ No newline at end of file
diff --git a/tests/com/gitblit/tests/GroovyScriptTest.java b/tests/com/gitblit/tests/GroovyScriptTest.java
index 3158736..b21c7e7 100644
--- a/tests/com/gitblit/tests/GroovyScriptTest.java
+++ b/tests/com/gitblit/tests/GroovyScriptTest.java
@@ -73,6 +73,9 @@
 		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");

--
Gitblit v1.9.1