lib/codeowners/git.rb in codeowners-0.0.1 vs lib/codeowners/git.rb in codeowners-0.0.2
- old
+ new
@@ -7,13 +7,14 @@
class Git
def initialize(base_directory)
@base_directory = Pathname.new(::File.expand_path(base_directory))
end
- def contributors(file)
+ def contributors(file, debug = false)
require "codeowners/git/contributors"
- output = git(["log", "--max-count=500", "--shortstat", %(--pretty=format:"author:%aN email:%ae"), "--no-color", "--", escape(file)])
+ output = git(["log", "--numstat", %(--pretty=format:"author:%aN email:%ae"), "--no-color", "--", escape(file)])
+ print_debug(output, debug)
Contributors.call(file, output)
end
private
@@ -39,8 +40,15 @@
Open3.popen3(env, command.join(" ")) do |_, stdout, stderr, wait_thr|
error.call(stderr.read) unless wait_thr.value.success?
return stdout.read
end
+ end
+
+ def print_debug(output, debug)
+ return unless debug
+
+ puts output
+ puts "\n" * 10
end
end
end