Sha256: f47801d037a6765e45b575af89c2a5875358f5e00385a776e2a5c6f2f7e91505

Contents?: true

Size: 544 Bytes

Versions: 8

Compression:

Stored size: 544 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").lines.grep(/Fetch URL/)[0].split(": ", 2)[1]
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
danger-2.1.2 lib/danger/scm_source/git_repo.rb
danger-2.1.1 lib/danger/scm_source/git_repo.rb
danger-2.1.0 lib/danger/scm_source/git_repo.rb
danger-2.0.1 lib/danger/scm_source/git_repo.rb
danger-2.0.0 lib/danger/scm_source/git_repo.rb
danger-0.10.1 lib/danger/scm_source/git_repo.rb
danger-0.10.0 lib/danger/scm_source/git_repo.rb
danger-0.9.1 lib/danger/scm_source/git_repo.rb