Fix git_dir path in CommitAncestor model. Fixes #2089
authorTom Clegg <tom@curoverse.com>
Wed, 12 Feb 2014 14:20:03 +0000 (06:20 -0800)
committerTim Pierce <twp@curoverse.com>
Wed, 12 Feb 2014 18:56:32 +0000 (13:56 -0500)
services/api/app/models/commit_ancestor.rb

index c3c6d5376b8cbdbc41869ab3a4b5fb1a5b682c52..71ea57fb95ce15f1d3c9d95479a0c3ddf145b446 100644 (file)
@@ -19,7 +19,7 @@ class CommitAncestor < ActiveRecord::Base
       next if repo.match /^\./
       git_dir = repo.match(/\.git$/) ? repo : File.join(repo, '.git')
       repo_name = repo.sub(/\.git$/, '')
-      ENV['GIT_DIR'] = File.join(@gitdirbase, repo, '.git')
+      ENV['GIT_DIR'] = File.join(@gitdirbase, git_dir)
       IO.foreach("|git rev-list --format=oneline '#{self.descendant.gsub /[^0-9a-f]/,""}'") do |line|
         self.is = false
         sha1, message = line.strip.split(" ", 2)
@@ -34,7 +34,7 @@ class CommitAncestor < ActiveRecord::Base
       end
     end
     if self.is.nil?
-      raise CommitNotFoundError: "Specified commit was not found"
+      raise CommitNotFoundError.new "Specified commit was not found"
     end
   end
 end