From 1126f26d21b3aadf364af09c79d27d39de5e9bb9 Mon Sep 17 00:00:00 2001 From: Thomas Wolf Date: Wed, 10 Mar 2021 19:26:39 +0100 Subject: [PATCH] ApplyCommand: fix "no newline at end" detection Check the last line of the last hunk of a file, not the last line of the whole patch. Note that C git only checks that this line starts with "\ " and is at least 12 characters long because of possible different texts when non- English messages are used. Change-Id: I0db81699eb3e99ed7b536a3e2b8dc97df1f58a89 Signed-off-by: Thomas Wolf --- .../org/eclipse/jgit/diff/hello.patch | Bin 0 -> 269 bytes .../org/eclipse/jgit/diff/hello_PostImage | Bin 0 -> 3 bytes .../org/eclipse/jgit/diff/hello_PreImage | Bin 0 -> 5 bytes .../eclipse/jgit/api/ApplyCommandTest.java | 20 +++++++++++++++++- .../org/eclipse/jgit/api/ApplyCommand.java | 6 +++++- 5 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/hello.patch create mode 100644 org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/hello_PostImage create mode 100644 org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/hello_PreImage diff --git a/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/hello.patch b/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/diff/hello.patch new file mode 100644 index 0000000000000000000000000000000000000000..f015a38062dabcfff1cfc914bdc857ae2135a282 GIT binary patch literal 269 zcmaKmF$%*l5Cr>s#r8sqM2vAdy&x}0bFxl}K*){3@$U_m6XGV-EZpufF{cErpLqsf zUQ)`0&`7yPc_Z{`?8e?0%YlU%&f31~NNfFBkW%Wq@*dhjIe1Tce@GA9CsbKVt^%GR uHDXFgxd^GS%HKl#6