Fix missing trailing newline with "Create Patch"
commit494065b97c2398566898728f6dffecf429977b6a
authorRobin Stocker <robin@nibor.org>
Sat, 8 Nov 2014 07:08:26 +0000 (8 18:08 +1100)
committerMatthias Sohn <matthias.sohn@sap.com>
Sun, 23 Nov 2014 01:13:12 +0000 (23 02:13 +0100)
treee66d48a118f31886edc394f57c61175db7949303
parent48fd04618e1866775186cbf29bfc55b7c3bdcf10
Fix missing trailing newline with "Create Patch"

The resulting patches didn't work with "git apply" because the trailing
newline was missing. Adding it makes it work, and it also still works
with Eclipse's "Apply Patch".

Just removing the line with "trim newline" at the end wasn't enough,
because the ByteArrayOutputStream was only overriding one of the write
methods (not the one with just one char). So the last newline was never
added to the StringBuilder. Replace it with a more straightforward
implementation.

Bug: 406134
Change-Id: If736ab3bc5972908a464212a29de8311b32e2718
Signed-off-by: Robin Stocker <robin@nibor.org>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/op/CreatePatchOperationTest.java
org.eclipse.egit.core/src/org/eclipse/egit/core/op/CreatePatchOperation.java
org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CreatePatchActionTest.java