Upload() public method

Execute the upload task on the socket.
public Upload ( Stream input, Stream output, Stream messages ) : void
input Stream /// raw input to read client commands from. Caller must ensure the /// input is buffered, otherwise read performance may suffer. ///
output Stream /// response back to the Git network client, to write the pack /// data onto. Caller must ensure the output is buffered, /// otherwise write performance may suffer. ///
messages Stream /// secondary "notice" channel to send additional messages out /// through. When run over SSH this should be tied back to the /// standard error channel of the command execution. For most /// other network connections this should be null. ///
return void
Exemplo n.º 1
0
            public override void Execute(DaemonClient client, Repository db)
            {
                var    rp     = new UploadPack(db);
                Stream stream = client.Stream;

                rp.Upload(stream, null, null);
            }
Exemplo n.º 2
0
		public void Upload(Stream inputStream, Stream outputStream) {
			using (var repository = GetRepository()) {
				using (var pack = new UploadPack(repository)) {
					pack.setBiDirectionalPipe(false);
					pack.Upload(inputStream, outputStream, outputStream);
				}
			}
		}
Exemplo n.º 3
0
 public ActionResult UploadPack(string project)
 {
     return ExecuteRpc(project, Rpc.UploadPack, repository => {
         using (var pack = new UploadPack(repository)) {
             pack.setBiDirectionalPipe(false);
             pack.Upload(Request.InputStream, Response.OutputStream, Response.OutputStream);
         }
     });
 }
Exemplo n.º 4
0
        public void UploadPack(string project)
        {
            Response.ContentType = "application/x-git-upload-pack-result";
            WriteNoCache();

            using (var repository = repositories.GetRepository(project))
            using (var pack = new UploadPack(repository)) {
                pack.setBiDirectionalPipe(false);
                pack.Upload(Request.InputStream, Response.OutputStream, Response.OutputStream);
            }
        }
Exemplo n.º 5
0
        private ActionResult ExecuteUploadPack(string project)
        {
            Response.ContentType = "application/x-git-upload-pack-result";
            SetNoCache();

            var directory = GetDirectoryInfo(project);
            if (GitSharp.Repository.IsValid(directory.FullName, true))
            {
                using (var repository = new GitSharp.Repository(directory.FullName))
                using (var pack = new UploadPack(repository))
                {
                    pack.setBiDirectionalPipe(false);
                    pack.Upload(GetInputStream(), Response.OutputStream, Response.OutputStream);
                }

                return new EmptyResult();
            }
            else
            {
                return new HttpNotFoundResult();
            }
        }
Exemplo n.º 6
0
			public override void Execute(DaemonClient client, Repository db)
			{
				var rp = new UploadPack(db);
				Stream stream = client.Stream;
				rp.Upload(stream, null, null);
			}
Exemplo n.º 7
0
            public InternalLocalFetchConnection( TransportLocal transport)
                : base(transport)
            {
                Repository dst;
                try
                {
                    dst = new Repository(transport.remoteGitDir);
                }
                catch (IOException)
                {
                    throw new TransportException(uri, "Not a Git directory");
                }

                PipedInputStream out_r;
                PipedOutputStream out_w;
                try
                {
                    in_r = new PipedInputStream();
                    in_w = new PipedOutputStream(in_r);

                    out_r = new PipedInputStream();
                    out_w = new PipedOutputStream(out_r);
                }
                catch (IOException ex)
                {
                    dst.Close();
                    throw new TransportException(uri, "Cannot connect pipes", ex);
                }

                worker = new Thread( () =>
                    {
                        try
                        {
                            UploadPack rp = new UploadPack(dst);
                            rp.Upload(out_r, in_w, null);
                        }
                        catch (IOException ex)
                        {
                            // Client side of the pipes should report the problem.
                            ex.printStackTrace();
                        }
                        catch (Exception ex)
                        {
                            // Clients side will notice we went away, and report.
                            ex.printStackTrace();
                        }
                        finally
                        {
                            try
                            {
                                out_r.close();
                            }
                            catch (IOException)
                            {
                                // Ignore close failure, we probably crashed above.
                            }

                            try
                            {
                                in_w.close();
                            } catch (IOException)
                            {
                                // Ignore close failure, we probably crashed above.
                            }

                            dst.Close();
                        }

                    });
                worker.Name = "JGit-Upload-Pack";
                worker.Start();

                init(in_r, out_w);
                readAdvertisedRefs();
            }
Exemplo n.º 8
0
            public InternalLocalFetchConnection(TransportLocal transport)
                : base(transport)
            {
                Repository dst;

                try
                {
                    dst = new Repository(transport.remoteGitDir);
                }
                catch (IOException)
                {
                    throw new TransportException(uri, "Not a Git directory");
                }

                PipedInputStream  out_r;
                PipedOutputStream out_w;

                try
                {
                    in_r = new PipedInputStream();
                    in_w = new PipedOutputStream(in_r);

                    out_r = new PipedInputStream();
                    out_w = new PipedOutputStream(out_r);
                }
                catch (IOException ex)
                {
                    dst.Close();
                    throw new TransportException(uri, "Cannot connect pipes", ex);
                }

                worker = new Thread(() =>
                {
                    try
                    {
                        UploadPack rp = new UploadPack(dst);
                        rp.Upload(out_r, in_w, null);
                    }
                    catch (IOException ex)
                    {
                        // Client side of the pipes should report the problem.
                        ex.printStackTrace();
                    }
                    catch (Exception ex)
                    {
                        // Clients side will notice we went away, and report.
                        ex.printStackTrace();
                    }
                    finally
                    {
                        try
                        {
                            out_r.close();
                        }
                        catch (IOException)
                        {
                            // Ignore close failure, we probably crashed above.
                        }

                        try
                        {
                            in_w.close();
                        } catch (IOException)
                        {
                            // Ignore close failure, we probably crashed above.
                        }

                        dst.Close();
                    }
                });
                worker.Name = "JGit-Upload-Pack";
                worker.Start();

                init(in_r, out_w);
                readAdvertisedRefs();
            }
Exemplo n.º 9
0
 private static void HandleUploadPackPost(HttpContext context, GitRoute route)
 {
     context.Response.ContentType = "application/x-git-upload-pack-result";
     var pack = new UploadPack(route.Repository);
     pack.setBiDirectionalPipe(false);
     pack.Upload(context.Request.InputStream, context.Response.OutputStream, context.Response.OutputStream);
 }