X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/2fe2dca0080d20a257e9d750cd6ca9d094f01a61..67f0d86c20139eee996816d44ef75fa52288c515:/services/api/app/models/commit.rb?ds=sidebyside diff --git a/services/api/app/models/commit.rb b/services/api/app/models/commit.rb index 830854d615..a6b085722e 100644 --- a/services/api/app/models/commit.rb +++ b/services/api/app/models/commit.rb @@ -119,6 +119,9 @@ class Commit < ActiveRecord::Base raise ArgumentError.new "invalid sha1 #{sha1}" end src_gitdir, _ = git_dir_for repo_name + unless src_gitdir + raise ArgumentError.new "no local repository for #{repo_name}" + end dst_gitdir = Rails.configuration.git_internal_dir must_pipe("echo #{sha1.shellescape}", "git --git-dir #{src_gitdir.shellescape} pack-objects -q --revs --stdout", @@ -154,8 +157,11 @@ class Commit < ActiveRecord::Base end def self.cache_dir_for git_url - Rails.root.join('tmp', 'git', Digest::SHA1.hexdigest(git_url) + ".git"). - to_s + File.join(cache_dir_base, Digest::SHA1.hexdigest(git_url) + ".git").to_s + end + + def self.cache_dir_base + Rails.root.join 'tmp', 'git' end def self.fetch_remote_repository gitdir, git_url