diff options
author | Thomas Wolf <thomas.wolf@paranor.ch> | 2022-02-26 12:46:50 +0100 |
---|---|---|
committer | Thomas Wolf <thomas.wolf@paranor.ch> | 2022-03-19 12:13:37 +0100 |
commit | ac78c175231979c7c5ab361980a233edee7626df (patch) | |
tree | 79643aca5d5db2fb8712532cf2038c0a6d157a13 /org.eclipse.jgit.test | |
parent | 45287f10978825349be9783950f1d99bc40d5f78 (diff) | |
download | jgit-ac78c175231979c7c5ab361980a233edee7626df.tar.gz jgit-ac78c175231979c7c5ab361980a233edee7626df.zip |
[sideband] Ensure last bit of progress channel is written
If the last sideband progress message didn't end in \r or \n, there
may still be a buffered message at the end of a fetch or push. Ensure
that message gets written, too, even if it may be only partial.
Bug: 575629
Change-Id: I38edccb5cffb89e00e468480b43c7d951fb63e8e
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/SideBandInputStreamTest.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/SideBandInputStreamTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/SideBandInputStreamTest.java index 497f584b5f..7ac83195fb 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/SideBandInputStreamTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/SideBandInputStreamTest.java @@ -79,6 +79,8 @@ public class SideBandInputStreamTest { init(packet("message")); assertTrue(sideband.read() < 0); assertEquals("", messages.toString()); + sideband.drainMessages(); + assertEquals("message\n", messages.toString()); } @Test @@ -128,6 +130,8 @@ public class SideBandInputStreamTest { init(packet("message 0%\rmessage 100%")); assertTrue(sideband.read() < 0); assertEquals("message 0%\r", messages.toString()); + sideband.drainMessages(); + assertEquals("message 0%\rmessage 100%\n", messages.toString()); } @Test @@ -135,6 +139,8 @@ public class SideBandInputStreamTest { init(packet("message 0%\nmessage 100%")); assertTrue(sideband.read() < 0); assertEquals("message 0%\n", messages.toString()); + sideband.drainMessages(); + assertEquals("message 0%\nmessage 100%\n", messages.toString()); } @Test @@ -142,6 +148,8 @@ public class SideBandInputStreamTest { init(packet("message 0%\r\nmessage 100%")); assertTrue(sideband.read() < 0); assertEquals("message 0%\r\n", messages.toString()); + sideband.drainMessages(); + assertEquals("message 0%\r\nmessage 100%\n", messages.toString()); } @Test @@ -152,6 +160,8 @@ public class SideBandInputStreamTest { assertEquals("", messages.toString()); assertTrue(sideband.read() < 0); assertEquals("message 0%\r", messages.toString()); + sideband.drainMessages(); + assertEquals("message 0%\rmessage 100%\n", messages.toString()); } @Test @@ -162,6 +172,8 @@ public class SideBandInputStreamTest { assertEquals("", messages.toString()); assertTrue(sideband.read() < 0); assertEquals("message 0%\n", messages.toString()); + sideband.drainMessages(); + assertEquals("message 0%\nmessage 100%\n", messages.toString()); } @Test @@ -172,6 +184,8 @@ public class SideBandInputStreamTest { assertEquals("", messages.toString()); assertTrue(sideband.read() < 0); assertEquals("message 0%\r\n", messages.toString()); + sideband.drainMessages(); + assertEquals("message 0%\r\nmessage 100%\n", messages.toString()); } @Test @@ -197,6 +211,9 @@ public class SideBandInputStreamTest { assertEquals("message 0%\r", messages.toString()); assertTrue(sideband.read() < 0); assertEquals("message 0%\rmessage 10%\r", messages.toString()); + sideband.drainMessages(); + assertEquals("message 0%\rmessage 10%\rmessage 100%\n", + messages.toString()); } private String packet(String data) { |