Class: GitWrapper::Commands::Diff

Inherits:
Git
  • Object
show all
Defined in:
lib/git_wrapper/commands/diff.rb

Instance Attribute Summary

Attributes inherited from Git

#error, #location_folder, #output

Instance Method Summary collapse

Methods inherited from Git

#execute, #initialize, #success?

Constructor Details

This class inherits a constructor from GitWrapper::Commands::Git

Instance Method Details

#commandObject



15
16
17
# File 'lib/git_wrapper/commands/diff.rb', line 15

def command
  "diff #{@commit}#{@reverse ? ' -R ' : ''} --name-status"
end

#resultObject



19
20
21
22
23
# File 'lib/git_wrapper/commands/diff.rb', line 19

def result
  output.split(/\n/).map do |line|
    Results::DiffNameStatus.parse(line)
  end
end

#reverseObject



10
11
12
13
# File 'lib/git_wrapper/commands/diff.rb', line 10

def reverse
  @reverse = true
  self
end

#with(commit) ⇒ Object



5
6
7
8
# File 'lib/git_wrapper/commands/diff.rb', line 5

def with(commit)
  @commit = commit
  self
end