Class: Mutant::Repository::Diff
- Inherits:
-
Object
- Object
- Mutant::Repository::Diff
- Includes:
- Adamantium
- Defined in:
- lib/mutant/repository.rb
Overview
Diff between two objects in repository
Constant Summary collapse
- HEAD =
'HEAD'.freeze
Class Method Summary collapse
-
.from_head(to) ⇒ Diff
private
Create diff from head to revision.
Instance Method Summary collapse
-
#touches?(path, line_range) ⇒ Boolean
private
Test if diff changes file at line range.
Class Method Details
Instance Method Details
#touches?(path, line_range) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Test if diff changes file at line range
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/mutant/repository.rb', line 50 def touches?(path, line_range) return false unless within_working_directory?(path) && tracks?(path) command = %W[ git log #{from}...#{to} -L #{line_range.begin},#{line_range.end}:#{path} ] stdout, status = Open3.capture2(*command, binmode: true) fail RepositoryError, "Command #{command} failed!" unless status.success? !stdout.empty? end |