diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PushCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PushCommandTest.java index ca86d8130..98dfcc083 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PushCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PushCommandTest.java @@ -148,7 +148,7 @@ public class PushCommandTest extends RepositoryTestCase { git1.push().setRemote("test").setRefSpecs(spec).call(); assertEquals("1:test, 2:" + uri + ", 3:\n" + "refs/heads/master " + commit.getName() + " refs/heads/x " - + ObjectId.zeroId().name(), read(hookOutput)); + + ObjectId.zeroId().name() + "\n", read(hookOutput)); } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/hooks/PrePushHook.java b/org.eclipse.jgit/src/org/eclipse/jgit/hooks/PrePushHook.java index 051a1d1c8..431944f9d 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/hooks/PrePushHook.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/hooks/PrePushHook.java @@ -164,12 +164,7 @@ public class PrePushHook extends GitHook { */ public void setRefs(Collection toRefs) { StringBuilder b = new StringBuilder(); - boolean first = true; for (RemoteRefUpdate u : toRefs) { - if (!first) - b.append("\n"); //$NON-NLS-1$ - else - first = false; b.append(u.getSrcRef()); b.append(" "); //$NON-NLS-1$ b.append(u.getNewObjectId().getName()); @@ -179,6 +174,7 @@ public class PrePushHook extends GitHook { ObjectId ooid = u.getExpectedOldObjectId(); b.append((ooid == null) ? ObjectId.zeroId().getName() : ooid .getName()); + b.append("\n"); //$NON-NLS-1$ } refs = b.toString(); }