diff options
author | Josh Brown <sjoshbrown@google.com> | 2022-11-01 18:16:44 +0000 |
---|---|---|
committer | Josh Brown <sjoshbrown@google.com> | 2022-11-02 20:12:03 +0000 |
commit | e8068188f134b2b6a0d96314a3642154a1b66ab4 (patch) | |
tree | fb3e01eeb84a2e5ac1ef8d1e7da81a4df5e0d121 /org.eclipse.jgit.test/tst | |
parent | 93097f001854af47db782462e78d67e7171043a4 (diff) | |
download | jgit-e8068188f134b2b6a0d96314a3642154a1b66ab4.tar.gz jgit-e8068188f134b2b6a0d96314a3642154a1b66ab4.zip |
FirstWant: Parse client session-id if received.
In protocol V0 the client capabilities are appended to the first line.
Parsing session-id is currently only supported during a ReceivePack
operation. This change will parse the client session-id capability if
it has been sent by the client.
If the server sends the session-id capability to the client. The client
may respond with a session ID of its own. FirstWant.fromLine will now
parse the ID and make it available via the getClientSID method.
This change does not add support to send the session-id capability from
the server. The change is necessary to support session-id in UploadPack.
Change-Id: Id3fe44fdf9a72984ee3de9cf40cc4e71d434df4a
Signed-off-by: Josh Brown <sjoshbrown@google.com>
Diffstat (limited to 'org.eclipse.jgit.test/tst')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/transport/parser/FirstWantTest.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/transport/parser/FirstWantTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/transport/parser/FirstWantTest.java index 1e8ce8ef11..230f6a4081 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/transport/parser/FirstWantTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/transport/parser/FirstWantTest.java @@ -27,7 +27,8 @@ public class FirstWantTest { @Test public void testFirstWantWithOptions() throws PackProtocolException { String line = "want b9d4d1eb2f93058814480eae9e1b67550f46ee38 " - + "no-progress include-tag ofs-delta agent=JGit/unknown"; + + "no-progress include-tag ofs-delta agent=JGit/unknown " + + "session-id=the.client.sid"; FirstWant r = FirstWant.fromLine(line); assertEquals("want b9d4d1eb2f93058814480eae9e1b67550f46ee38", @@ -37,6 +38,7 @@ public class FirstWantTest { Arrays.asList("no-progress", "include-tag", "ofs-delta")); assertEquals(expectedCapabilities, capabilities); assertEquals("JGit/unknown", r.getAgent()); + assertEquals("the.client.sid", r.getClientSID()); } @Test @@ -94,4 +96,12 @@ public class FirstWantTest { assertEquals(r.getCapabilities().size(), 0); assertEquals("pack.age/Version", r.getAgent()); } + + @Test + public void testFirstWantValidSessionID() throws PackProtocolException { + FirstWant r = FirstWant + .fromLine(makeFirstWantLine("session-id=client.session.id")); + assertEquals(r.getCapabilities().size(), 0); + assertEquals("client.session.id", r.getClientSID()); + } } |