Class: Renegade::ConflictMarkers

Inherits:
Object
  • Object
show all
Defined in:
lib/renegade/conflict_markers.rb

Overview

Prevent merge artifacts from getting committed

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConflictMarkers

Returns a new instance of ConflictMarkers.



9
10
11
12
# File 'lib/renegade/conflict_markers.rb', line 9

def initialize
  @label = 'No merge artifacts'
  @errors = []
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



7
8
9
# File 'lib/renegade/conflict_markers.rb', line 7

def errors
  @errors
end

Instance Method Details

#run(markers) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/renegade/conflict_markers.rb', line 14

def run(markers)
  # markers = `git diff-index --check --cached HEAD --`
  if markers == ''
    Status.report(@label, true)
  else
    Status.report(@label, false)
    @errors.push('Merge artifacts were found!' + "\n" + markers)
  end
end