summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2008-05-29 18:48:00 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2008-05-29 18:48:00 +0000
commite1a86106d0c5317d75eef170c1d676f9c3d464f4 (patch)
tree6bb6348a74fd39236ebb1bd1a3bf0f4e5e054801
parent39216f327c632fd9c2ed74294b0753e610235d68 (diff)
downloadredmine-e1a86106d0c5317d75eef170c1d676f9c3d464f4.tar.gz
redmine-e1a86106d0c5317d75eef170c1d676f9c3d464f4.zip
Fixed: GitAdapter#get_rev should use current branch instead of hardwiring @master@ (#1319).
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1475 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--lib/redmine/scm/adapters/git_adapter.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/redmine/scm/adapters/git_adapter.rb b/lib/redmine/scm/adapters/git_adapter.rb
index a9ab505a8..9dfbd17a8 100644
--- a/lib/redmine/scm/adapters/git_adapter.rb
+++ b/lib/redmine/scm/adapters/git_adapter.rb
@@ -27,9 +27,13 @@ module Redmine
# Get the revision of a particuliar file
def get_rev (rev,path)
- cmd="#{GIT_BIN} --git-dir #{target('')} show #{shell_quote rev} -- #{shell_quote path}" if rev!='latest' and (! rev.nil?)
- cmd="#{GIT_BIN} --git-dir #{target('')} log -1 master -- #{shell_quote path}" if
- rev=='latest' or rev.nil?
+
+ if rev != 'latest' && !rev.nil?
+ cmd="#{GIT_BIN} --git-dir #{target('')} show #{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 -1 #{branch} -- #{shell_quote path}"
+ end
rev=[]
i=0
shellout(cmd) do |io|