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;
@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$
@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);
import java.io.OutputStream;
import java.net.InetAddress;
import java.net.Socket;
+import java.util.Arrays;
+import java.util.Collection;
import org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException;
import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException;
if (0 < daemon.getTimeout())
sock.setSoTimeout(daemon.getTimeout() * 1000);
String cmd = new PacketLineIn(rawIn).readStringRaw();
+
+ Collection<String> extraParameters = null;
+
+ int nulnul = cmd.indexOf("\0\0"); //$NON-NLS-1$
+ if (nulnul != -1) {
+ extraParameters = Arrays.asList(cmd.substring(nulnul + 2).split("\0")); //$NON-NLS-1$
+ }
+
final int nul = cmd.indexOf('\0');
if (nul >= 0) {
// Newer clients hide a "host" header behind this byte.
if (srv == null)
return;
sock.setSoTimeout(0);
- srv.execute(this, cmd);
+ srv.execute(this, cmd, extraParameters);
}
}
package org.eclipse.jgit.transport;
import java.io.IOException;
+import java.util.Collection;
+import org.eclipse.jgit.annotations.Nullable;
import org.eclipse.jgit.lib.Config;
import org.eclipse.jgit.lib.Config.SectionParser;
import org.eclipse.jgit.lib.Repository;
&& commandLine.startsWith(command);
}
- void execute(final DaemonClient client, final String commandLine)
+ void execute(DaemonClient client, String commandLine,
+ @Nullable Collection<String> extraParameters)
throws IOException, ServiceNotEnabledException,
ServiceNotAuthorizedException {
final String name = commandLine.substring(command.length() + 1);
try (Repository db = client.getDaemon().openRepository(client, name)) {
if (isEnabledFor(db)) {
- execute(client, db);
+ execute(client, db, extraParameters);
}
} catch (ServiceMayNotContinueException e) {
// An error when opening the repo means the client is expecting a ref
return isEnabled();
}
- abstract void execute(DaemonClient client, Repository db)
+ abstract void execute(DaemonClient client, Repository db,
+ @Nullable Collection<String> extraParameters)
throws IOException, ServiceNotEnabledException,
ServiceNotAuthorizedException;
}