From bf5f7f8d4f8d1b2ab5ae3969fa7b6a696a11b01a Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Sat, 25 Jul 2015 11:18:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E5=88=86=E6=94=AF=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/repository/git.rb | 4 ++-- lib/redmine/scm/adapters/git_adapter.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/repository/git.rb b/app/models/repository/git.rb index 041175572..7c484e87f 100644 --- a/app/models/repository/git.rb +++ b/app/models/repository/git.rb @@ -38,8 +38,8 @@ class Repository::Git < Repository 'Git' end - def commits(authors, start_date, end_date) - scm.commits(authors, start_date, end_date).map {|commit| + def commits(authors, start_date, end_date, branch='master') + scm.commits(authors, start_date, end_date,branch).map {|commit| [commit[:author], commit[:num]] } end diff --git a/lib/redmine/scm/adapters/git_adapter.rb b/lib/redmine/scm/adapters/git_adapter.rb index 6c56a7e24..927018b34 100644 --- a/lib/redmine/scm/adapters/git_adapter.rb +++ b/lib/redmine/scm/adapters/git_adapter.rb @@ -396,10 +396,10 @@ module Redmine sum[:insertion] + sum[:deletion] end - def commits(authors, start_date, end_date) + def commits(authors, start_date, end_date, branch='master') rs = [] authors.each do |author| - cmd_args = %W|log --pretty=tformat: --shortstat --author=#{author} --since=#{start_date} --until=#{end_date}| + cmd_args = %W|log #{branch} --pretty=tformat: --shortstat --author=#{author} --since=#{start_date} --until=#{end_date}| commits = '' git_cmd(cmd_args) do |io| commits = io.read