Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Stocker2014-11-08 07:08:26 +0000
committerMatthias Sohn2014-11-23 01:13:12 +0000
commit494065b97c2398566898728f6dffecf429977b6a (patch)
treee66d48a118f31886edc394f57c61175db7949303 /org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team
parent48fd04618e1866775186cbf29bfc55b7c3bdcf10 (diff)
downloadegit-494065b97c2398566898728f6dffecf429977b6a.tar.gz
egit-494065b97c2398566898728f6dffecf429977b6a.tar.xz
egit-494065b97c2398566898728f6dffecf429977b6a.zip
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>
Diffstat (limited to 'org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team')
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CreatePatchActionTest.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CreatePatchActionTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CreatePatchActionTest.java
index 83cd5ae9d9..dfe8735bf3 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CreatePatchActionTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CreatePatchActionTest.java
@@ -52,7 +52,7 @@ public class CreatePatchActionTest extends LocalRepositoryTestCase {
+ "-oldContent\n"
+ "\\ No newline at end of file\n"
+ "+newContent\n" //
- + "\\ No newline at end of file";
+ + "\\ No newline at end of file\n";
private static final String EXPECTED_WORKSPACE_PATCH_CONTENT = //
"### Eclipse Workspace Patch 1.0\n" //
@@ -82,7 +82,7 @@ public class CreatePatchActionTest extends LocalRepositoryTestCase {
+ "+++ test.txt\n" //
+ "@@ -0,0 +1 @@\n" //
+ "+Hello, world\n" //
- + "\\ No newline at end of file";
+ + "\\ No newline at end of file\n";
@Before
public void setup() throws Exception {

Back to the top