Class: Command::Push

Inherits:
Base
  • Object
show all
Includes:
FastForward, RemoteClient, SendObjects
Defined in:
lib/command/push.rb

Constant Summary collapse

CAPABILITIES =
["report-status"]
RECEIVE_PACK =
"git-receive-pack"
UNPACK_LINE =
/^unpack (.+)$/
UPDATE_LINE =
/^(ok|ng) (\S+)(.*)$/

Constants included from RemoteClient

RemoteClient::REF_LINE, RemoteClient::ZERO_OID

Instance Attribute Summary

Attributes inherited from Base

#status

Instance Method Summary collapse

Methods included from SendObjects

#send_packed_objects

Methods included from RemoteClient

#build_agent_command, #recv_references, #report_range_update, #report_ref_update, #show_ref_update, #ssh_command, #start_agent

Methods included from FastForward

#fast_forward?, #fast_forward_error

Methods inherited from Base

#execute, #initialize

Constructor Details

This class inherits a constructor from Command::Base

Instance Method Details

#define_optionsObject



21
22
23
24
25
26
27
# File 'lib/command/push.rb', line 21

def define_options
  @parser.on("-f", "--force") { @options[:force] = true }

  @parser.on "--receive-pack=<receive-pack>" do |receiver|
    @options[:receiver] = receiver
  end
end

#runObject



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/command/push.rb', line 29

def run
  configure
  start_agent("push", @receiver, @push_url, CAPABILITIES)

  recv_references
  send_update_requests
  send_objects
  print_summary
  recv_report_status

  exit (@errors.empty? ? 0 : 1)
end