Class: GitCommands::Merge

Inherits:
Command
  • Object
show all
Includes:
GitCommands
Defined in:
lib/straight_line/common/git_commands/merge.rb

Overview

Merge a branch into base

Instance Attribute Summary

Attributes inherited from Command

#working_dir

Instance Method Summary collapse

Methods included from GitCommands

#handle_merge_conflict

Methods inherited from Command

#arg, from_file, #run_sub_commands, #sub_command

Constructor Details

#initialize(base, branch) ⇒ Merge



8
9
10
11
12
13
14
15
16
17
# File 'lib/straight_line/common/git_commands/merge.rb', line 8

def initialize(base, branch)
  super('git')
  arg 'checkout'
  arg base
  merge_command = Command.new('git')
                         .arg('merge --no-ff')
                         .arg(branch)

  sub_command merge_command
end

Instance Method Details

#run(*_args) ⇒ Object



19
20
21
22
23
24
# File 'lib/straight_line/common/git_commands/merge.rb', line 19

def run(*_args)
  super true

rescue ShellError => e
  handle_merge_conflict e
end