diff options
-rw-r--r-- | lib/gitlab/git/remote_repository.rb | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/gitlab/git/remote_repository.rb b/lib/gitlab/git/remote_repository.rb index 3e5a91ed065..3685aa20669 100644 --- a/lib/gitlab/git/remote_repository.rb +++ b/lib/gitlab/git/remote_repository.rb @@ -15,25 +15,36 @@ module Gitlab attr_reader :path, :relative_path, :gitaly_repository def initialize(repository) - @repository = repository @relative_path = repository.relative_path - @path = repository.path @gitaly_repository = repository.gitaly_repository + + # These instance variables will not be available in gitaly-ruby, where + # we have no disk access to this repository. + @repository = repository + @path = repository.path end def empty_repo? + # We will override this implementation in gitaly-ruby because we cannot + # use '@repository' there. @repository.empty_repo? end def commit_id(revision) + # We will override this implementation in gitaly-ruby because we cannot + # use '@repository' there. @repository.commit(revision)&.sha end def branch_exists?(name) + # We will override this implementation in gitaly-ruby because we cannot + # use '@repository' there. @repository.branch_exists?(name) end - # Compares self to a Gitlab::Git::Repository. + # Compares self to a Gitlab::Git::Repository. This implementation uses + # 'self.gitaly_repository' so that it will also work in the + # GitalyRemoteRepository subclass defined in gitaly-ruby. def same_repository?(other_repository) gitaly_repository.storage_name == other_repository.storage && gitaly_repository.relative_path == other_repository.relative_path |