From c3bca3fccbf6b86f354f37c51bf0ce45d9481590 Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Sun, 20 Feb 2011 01:33:50 +0000 Subject: [PATCH] scm: git: fix wrong commit range in git log command on Windows (#7657). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4887 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/redmine/scm/adapters/git_adapter.rb | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/lib/redmine/scm/adapters/git_adapter.rb b/lib/redmine/scm/adapters/git_adapter.rb index d23fc2240c..73b79d5d8a 100644 --- a/lib/redmine/scm/adapters/git_adapter.rb +++ b/lib/redmine/scm/adapters/git_adapter.rb @@ -145,17 +145,18 @@ module Redmine def revisions(path, identifier_from, identifier_to, options={}) revisions = Revisions.new + cmd_args = %w|log --raw --date=iso --pretty=fuller| + cmd_args << "--reverse" if options[:reverse] + cmd_args << "--all" if options[:all] + cmd_args << "-n" << "#{options[:limit].to_i}" if options[:limit] + from_to = "" + from_to << "#{identifier_from}.." if identifier_from + from_to << "#{identifier_to}" if identifier_to + cmd_args << from_to if !from_to.empty? + cmd_args << "--since=#{options[:since].strftime("%Y-%m-%d %H:%M:%S")}" if options[:since] + cmd_args << "--" << "#{path}" if path && !path.empty? - cmd = "#{self.class.sq_bin} --git-dir #{target('')} log --no-color --raw --date=iso --pretty=fuller " - cmd << " --reverse " if options[:reverse] - cmd << " --all " if options[:all] - cmd << " -n #{options[:limit].to_i} " if options[:limit] - cmd << "#{shell_quote(identifier_from + '..')}" if identifier_from - cmd << "#{shell_quote identifier_to}" if identifier_to - cmd << " --since=#{shell_quote(options[:since].strftime("%Y-%m-%d %H:%M:%S"))}" if options[:since] - cmd << " -- #{shell_quote path}" if path && !path.empty? - - shellout(cmd) do |io| + scm_cmd *cmd_args do |io| files=[] changeset = {} parsing_descr = 0 #0: not parsing desc or files, 1: parsing desc, 2: parsing files @@ -232,8 +233,8 @@ module Redmine end end end - - return nil if $? && $?.exitstatus != 0 + revisions + rescue ScmCommandAborted revisions end