lib/danger/scm_source/git_repo.rb in danger-additional-logging-0.0.1 vs lib/danger/scm_source/git_repo.rb in danger-additional-logging-0.0.2
- old
+ new
@@ -8,10 +8,11 @@
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)
@@ -69,24 +70,28 @@
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)
end
def ensure_commitish_exists_on_branch!(branch, commitish)
return if commit_exists?(commitish)
+ puts "ensure_commitish_exists_on_branch!"
+
depth = 0
success =
(3..6).any? do |factor|
depth += Math.exp(factor).to_i
+ puts "git_fetch_branch_to_depth(#{branch}, depth=#{depth})"
git_fetch_branch_to_depth(branch, depth)
commit_exists?(commitish)
end
@@ -121,9 +126,11 @@
def commit_not_exists?(sha1)
exec("rev-parse --quiet --verify #{sha1}^{commit}").empty?
end
def find_merge_base(repo, from, to)
+ puts "find_merge_base(repo=#{repo}, from=#{from}, to=#{to})"
+
possible_merge_base = possible_merge_base(repo, from, to)
return possible_merge_base if possible_merge_base
possible_merge_base = find_merge_base_with_incremental_fetch(repo, from, to)
return possible_merge_base if possible_merge_base