Merge branch '14946-ruby-2.5'
[arvados.git] / services / api / app / models / commit.rb
index 19254ce8846a326d747d49928d4b7a21baaa9011..2f7e9cd9345ff347c9f5bee05abe58a113dd267b 100644 (file)
@@ -2,10 +2,12 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
+require 'request_error'
+
 class Commit < ActiveRecord::Base
   extend CurrentApiClient
 
-  class GitError < StandardError
+  class GitError < RequestError
     def http_status
       422
     end
@@ -146,7 +148,7 @@ class Commit < ActiveRecord::Base
     unless src_gitdir
       raise ArgumentError.new "no local repository for #{repo_name}"
     end
-    dst_gitdir = Rails.configuration.git_internal_dir
+    dst_gitdir = Rails.configuration.Containers.JobsAPI.GitInternalDir
 
     begin
       commit_in_dst = must_git(dst_gitdir, "log -n1 --format=%H #{sha1.shellescape}^{commit}").strip
@@ -233,7 +235,7 @@ class Commit < ActiveRecord::Base
     begin
       must_git gitdir, "branch"
     rescue GitError => e
-      raise unless /Not a git repository/ =~ e.to_s
+      raise unless /Not a git repository/i =~ e.to_s
       # OK, this just means we need to create a blank cache repository
       # before fetching.
       FileUtils.mkdir_p gitdir