Sha256: 17b8a7f6f3bff4de2d9c936c15f06ac2eccaffe5722b98844c972ace8623d9c5

Contents?: true

Size: 538 Bytes

Versions: 1

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

1 entries across 1 versions & 1 rubygems

Version Path
danger-0.8.5 lib/danger/scm_source/git_repo.rb