Class: Git::Lib
- Inherits:
-
Object
- Object
- Git::Lib
- Defined in:
- lib/client/git_adapter/git_gem.rb
Instance Method Summary collapse
- #command_lines(cmd, opts = [], chdir = true, redirect = '') ⇒ Object
- #merge(branch, message = nil, opts = {}) ⇒ Object
- #name_status(branch1 = nil, branch2 = nil, opts = {}) ⇒ Object
- #rev_list(sha) ⇒ Object
Instance Method Details
#command_lines(cmd, opts = [], chdir = true, redirect = '') ⇒ Object
54 55 56 57 58 59 60 61 |
# File 'lib/client/git_adapter/git_gem.rb', line 54 def command_lines(cmd, opts = [], chdir = true, redirect = '') cmd_op = command(cmd, opts, chdir) op = cmd_op.encode("UTF-8", "binary", { :invalid => :replace, :undef => :replace }) op.split("\n") end |
#merge(branch, message = nil, opts = {}) ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/client/git_adapter/git_gem.rb', line 26 def merge(branch, = nil, opts = {}) arr_opts = [] arr_opts << '--allow-unrelated-histories' if opts[:allow_unrelated_histories] arr_opts << '-Xtheirs' if opts[:use_theirs] arr_opts << '-m' << if arr_opts += [branch] command('merge', arr_opts) end |
#name_status(branch1 = nil, branch2 = nil, opts = {}) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/client/git_adapter/git_gem.rb', line 40 def name_status(branch1 = nil, branch2 = nil, opts = {}) arr_opts = [] arr_opts << '--name-status' arr_opts << "--diff-filter=#{opts[:diff_filter]}" if opts[:diff_filter] arr_opts << branch1 if branch1 arr_opts << branch2 if branch2 command_lines('diff', arr_opts).inject({}) do |memo, line| status, path = line.split("\t") memo[path] = status memo end end |
#rev_list(sha) ⇒ Object
35 36 37 38 |
# File 'lib/client/git_adapter/git_gem.rb', line 35 def rev_list(sha) arr_opts = [sha] command('rev-list', arr_opts) end |