X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/fb79ddbedcc8c459daccaa6eec05b07206865bae..e16542e3cb4fddf05c407cb013c9e1573eb9c289:/services/api/app/models/commit.rb diff --git a/services/api/app/models/commit.rb b/services/api/app/models/commit.rb index b0efbc7cb0..2f7e9cd934 100644 --- a/services/api/app/models/commit.rb +++ b/services/api/app/models/commit.rb @@ -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 @@ -219,7 +221,7 @@ class Commit < ActiveRecord::Base end def self.cache_dir_base - Rails.root.join 'tmp', 'git' + Rails.root.join 'tmp', 'git-cache' end def self.fetch_remote_repository gitdir, git_url @@ -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