lib/danger/scm_source/git_repo.rb in danger-additional-logging-0.0.7 vs lib/danger/scm_source/git_repo.rb in danger-additional-logging-0.0.8
- old
+ new
@@ -47,17 +47,20 @@
after: after_match.captures.first
}
end.compact
end
- def exec(string)
+ def exec(string, prints=false)
+ puts "exec: git #{string}, prints output #{prints}"
require "open3"
Dir.chdir(self.folder || ".") do
git_command = string.split(" ").dup.unshift("git")
Open3.popen2(default_env, *git_command) do |_stdin, stdout, _wait_thr|
output = stdout.read.rstrip
- puts output # Print the captured output
+ if (prints)
+ puts output # Print the captured output
+ end
output # Return the captured output
end
end
end
@@ -96,11 +99,12 @@
end
puts "Is shallow repo:"
exec("rev-parse --is-shallow-repository")
- puts "Last 5 commits befor starting git_fetch_branch_to_depth:"
+ puts "Last 5 commits for #{branch}"
+ exec("branch -v")
exec("--no-pager log -n 5")
depth = 0
success =
(3..6).any? do |factor|
@@ -123,10 +127,9 @@
def git_in_depth_fetch
exec("fetch --depth 1000000")
end
def git_fetch_branch_to_depth(branch, depth)
- puts "fetch --depth=#{depth} --prune origin +refs/heads/#{branch}:refs/remotes/origin/#{branch}"
exec("fetch --depth=#{depth} --prune origin +refs/heads/#{branch}:refs/remotes/origin/#{branch}")
end
def default_env
{ "LANG" => "en_US.UTF-8" }