Class: RJGit::RJGitReceivePack

Inherits:
RJGitPack show all
Defined in:
lib/transport.rb

Instance Attribute Summary

Attributes inherited from RJGitPack

#bidirectional, #jpack, #jrepo

Instance Method Summary collapse

Methods inherited from RJGitPack

#advertise_refs, #init_buffers

Constructor Details

#initialize(repository, bidirectional = false) ⇒ RJGitReceivePack

Returns a new instance of RJGitReceivePack.



33
34
35
36
# File 'lib/transport.rb', line 33

def initialize(repository, bidirectional = false)
  super
  @jpack = ReceivePack.new(@jrepo)
end

Instance Method Details

#process(client_msg) ⇒ Object



38
39
40
# File 'lib/transport.rb', line 38

def process(client_msg)
  self.receive(client_msg)
end

#receive(client_msg) ⇒ Object



42
43
44
45
46
47
48
49
50
51
# File 'lib/transport.rb', line 42

def receive(client_msg)
    in_stream, out_stream = init_buffers(client_msg)
    @jpack.set_bi_directional_pipe(@bidirectional)
    begin
      @jpack.receive(in_stream, out_stream, nil)
    rescue Java::OrgEclipseJgitErrors::InvalidObjectIdException, Java::JavaIo::IOException => e
      return nil, e
    end
    return ByteArrayInputStream.new(out_stream.to_byte_array).to_io, nil
end