Sha256: 2f66927acb39233221d87ba3f55b2b9a2a46a3c961ddd3aa57d1efca0f46efca

Contents?: true

Size: 538 Bytes

Versions: 2

Compression:

Stored size: 538 Bytes

Contents

# For more info see: https://github.com/schacon/ruby-git

require 'git'

module Danger
  class GitRepo
    attr_accessor :diff, :log

    def diff_for_folder(folder, from: "master", to: 'HEAD')
      repo = Git.open folder
      self.diff = repo.diff(from, to)
      self.log = repo.log.between(from, to)
    end

    def exec(string)
      `git #{string}`.strip
    end

    def head_commit
      exec "rev-parse HEAD"
    end

    def origins
      exec "remote show origin -n | grep \"Fetch URL\" | cut -d ':' -f 2-"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
danger-0.8.4 lib/danger/scm_source/git_repo.rb
danger-0.8.3 lib/danger/scm_source/git_repo.rb