lib/danger/scm_source/git_repo.rb in danger-additional-logging-0.0.13 vs lib/danger/scm_source/git_repo.rb in danger-additional-logging-0.0.14
- old
+ new
@@ -8,11 +8,10 @@
def diff_for_folder(folder, from: "master", to: "HEAD", lookup_top_level: false)
self.folder = folder
git_top_level = find_git_top_level_if_needed!(folder, lookup_top_level)
- puts "diff_for_folder(folder=#{folder}, from=#{from}, to=#{to}, lookup=#{lookup_top_level})"
repo = Git.open(git_top_level)
ensure_commitish_exists!(from)
ensure_commitish_exists!(to)
@@ -75,11 +74,10 @@
def origins
exec("remote show origin -n").lines.grep(/Fetch URL/)[0].split(": ", 2)[1].chomp
end
def ensure_commitish_exists!(commitish)
- puts "ensure_commitish_exists! #{commitish}"
return ensure_commitish_exists_on_branch!(commitish, commitish) if commit_is_ref?(commitish)
return if commit_exists?(commitish)
git_in_depth_fetch
raise_if_we_cannot_find_the_commit(commitish) if commit_not_exists?(commitish)
@@ -98,11 +96,10 @@
puts "The commit #{commitish} DOES NOT exist in #{branch}"
end
puts "Last 2 commits for current branch"
exec("branch -v", true)
- exec("--no-pager log -n 2", true)
depth = 0
success =
(3..6).any? do |factor|
depth += Math.exp(factor).to_i
@@ -181,11 +178,11 @@
end
end
def possible_merge_base(repo, from, to)
puts "possible_merge_base(from=#{from}, to=#{to})"
- exec("rev-list --max-parents=0 #{from}", true)
- exec("rev-list --max-parents=0 #{to}", true)
+ exec("--no-pager log #{from} -n 50", true)
+ exec("--no-pager log #{to} -n 50", true)
[repo.merge_base(from, to)].find { |base| commit_exists?(base) }
end
def commits_in_branch_count(from, to)