#
# 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
branch = m[1]
must_git(dst_gitdir,
"fetch file://#{src_gitdir.shellescape} #{branch.shellescape}")
+ # Even if all of the above steps succeeded, we might still not
+ # have the right commit due to a race, in which case tag_cmd
+ # will fail, and we'll need to fall back to pack|unpack. So
+ # don't be tempted to condense this tag_cmd and the one in the
+ # rescue block into a single attempt.
must_git(dst_gitdir, tag_cmd)
rescue GitError
must_pipe("echo #{sha1.shellescape}",
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