Sha256: 55a0c0e9bfeafab10e1afea090319456ee81af9d9e4d9974bc6fa0d15ea2a2e8

Contents?: true

Size: 649 Bytes

Versions: 2

Compression:

Stored size: 649 Bytes

Contents

require 'git'
# TestDiff module
module TestDiff
  # module for version control adapters
  module VersionControl
    # class to find changed files for git
    class Git
      include Logging

      def initialize(wd, last_tracked, current = 'HEAD', git_lib = ::GIT)
        @git = git_lib.open(wd)
        @last_tracked = last_tracked
        @current = current
      end

      def changed_files
        diff_changed_files
      end

      private

      def diff_changed_files
        @git.diff(@last_tracked, @current).map(&:path).tap do |files|
          log_debug "diff_changed_files: #{files.join(',')}"
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
test_diff-0.4.1 lib/test_diff/version_control/git.rb
test_diff-0.4.0 lib/test_diff/version_control/git.rb