Class: Rdm::Git::DiffManager

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

Constant Summary collapse

GIT_ERROR_MESSAGE =
"fatal: Not a git repository (or any of the parent directories): .git"
DEFAULT_REVISION =
'HEAD'

Class Method Summary collapse

Class Method Details

.run(path:, revision: nil) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/rdm/git/diff_manager.rb', line 10

def run(path:, revision: nil)
  abs_path = Rdm::Git::RepositoryLocator.locate(path)

  check_repository_initialized!(abs_path)

  return Rdm::Git::DiffCommand
    .get_diff_stat(revision: revision, path: abs_path)
    .reject(&:empty?)
    .map { |filename| File.expand_path(File.join(abs_path, filename)) }
end