#
# 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
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
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