From 3fdc27325286e23d2382b3c37b394e270b234ba7 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Mon, 17 Nov 2008 17:27:08 +0000 Subject: [PATCH] Do not query multiple times git for branch (#1435). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2043 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/redmine/scm/adapters/git_adapter.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/redmine/scm/adapters/git_adapter.rb b/lib/redmine/scm/adapters/git_adapter.rb index 47c192105..a9e1dda5c 100644 --- a/lib/redmine/scm/adapters/git_adapter.rb +++ b/lib/redmine/scm/adapters/git_adapter.rb @@ -31,8 +31,8 @@ module Redmine if rev != 'latest' && !rev.nil? cmd="#{GIT_BIN} --git-dir #{target('')} show --date=iso --pretty=fuller #{shell_quote rev} -- #{shell_quote path}" else - branch = shellout("#{GIT_BIN} --git-dir #{target('')} branch") { |io| io.grep(/\*/)[0].strip.match(/\* (.*)/)[1] } - cmd="#{GIT_BIN} --git-dir #{target('')} log --date=iso --pretty=fuller -1 #{branch} -- #{shell_quote path}" + @branch ||= shellout("#{GIT_BIN} --git-dir #{target('')} branch") { |io| io.grep(/\*/)[0].strip.match(/\* (.*)/)[1] } + cmd="#{GIT_BIN} --git-dir #{target('')} log --date=iso --pretty=fuller -1 #{@branch} -- #{shell_quote path}" end rev=[] i=0 -- 2.39.5