Class: Rdm::Git::DiffCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/rdm/git/diff_command.rb

Constant Summary collapse

GIT_FILE_REPLACE_REGEX =
/{(?<old>[\w_\d\.]+)\s*=>\s*(?<new>[\w_\d\.]+)}/

Class Method Summary collapse

Class Method Details

.get_diff_stat(revision:, path:) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/rdm/git/diff_command.rb', line 13

def get_diff_stat(revision:, path:)
  command = `cd #{path} && git diff --stat #{revision}`
  
  raise Rdm::Errors::GitCommandError, command unless $?.success?

  format_diff_stat_command(command)
end

.get_only_diff_filenames(revision:, path:) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/rdm/git/diff_command.rb', line 5

def get_only_diff_filenames(revision:, path:)
  command = `cd #{path} && git diff --name-only #{revision}`

  raise Rdm::Errors::GitCommandError, command unless $?.success?

  command.split("\n")
end