aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/transport/Daemon.java
diff options
context:
space:
mode:
authorJonathan Tan <jonathantanmy@google.com>2018-02-23 16:55:03 -0800
committerJonathan Nieder <jrn@google.com>2018-05-16 20:58:31 -0400
commit2841bab938b823c47041adc98d3a24673fd57475 (patch)
tree7d08c0096498b2609f4b3b66136defc5fe71417e /org.eclipse.jgit/src/org/eclipse/jgit/transport/Daemon.java
parent526f5cf9840490720f8b4fd6d647bb8beb67e143 (diff)
downloadjgit-2841bab938b823c47041adc98d3a24673fd57475.tar.gz
jgit-2841bab938b823c47041adc98d3a24673fd57475.zip
Add protocol v2 support in "jgit daemon"
With this patch, a server spawned by "jgit daemon" can be accessed using protocol v2 from a Git client that supports it (for example, "git" with the appropriate patches). This is only activated if the repository's config has "protocol.version" be 2. This required a change to the package-private #execute methods in DaemonService to allow passing of extra parameters. This has been tested with a patched Git. Change-Id: Icf043efec7ce956d72b075fc6dc7a87d5a2da82a Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/transport/Daemon.java')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/Daemon.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/Daemon.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/Daemon.java
index 2b2f257822..6563905282 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/Daemon.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/Daemon.java
@@ -53,7 +53,9 @@ import java.net.Socket;
import java.net.SocketAddress;
import java.net.SocketException;
import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.Collection;
+import org.eclipse.jgit.annotations.Nullable;
import org.eclipse.jgit.errors.RepositoryNotFoundException;
import org.eclipse.jgit.internal.JGitText;
import org.eclipse.jgit.lib.PersonIdent;
@@ -153,12 +155,17 @@ public class Daemon {
@Override
protected void execute(final DaemonClient dc,
- final Repository db) throws IOException,
+ final Repository db,
+ @Nullable Collection<String> extraParameters)
+ throws IOException,
ServiceNotEnabledException,
ServiceNotAuthorizedException {
UploadPack up = uploadPackFactory.create(dc, db);
InputStream in = dc.getInputStream();
OutputStream out = dc.getOutputStream();
+ if (extraParameters != null) {
+ up.setExtraParameters(extraParameters);
+ }
up.upload(in, out, null);
}
}, new DaemonService("receive-pack", "receivepack") { //$NON-NLS-1$ //$NON-NLS-2$
@@ -168,7 +175,9 @@ public class Daemon {
@Override
protected void execute(final DaemonClient dc,
- final Repository db) throws IOException,
+ final Repository db,
+ @Nullable Collection<String> extraParameters)
+ throws IOException,
ServiceNotEnabledException,
ServiceNotAuthorizedException {
ReceivePack rp = receivePackFactory.create(dc, db);