summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Vosmaer <jacob@gitlab.com>2017-11-10 14:24:38 +0100
committerJacob Vosmaer <jacob@gitlab.com>2017-11-10 14:24:38 +0100
commitda3b51bce67351b8101162c57e3c6520be228990 (patch)
treeb9b0543ca71bfd10d2dafc0e8a1d46cdff7002b8
parent6e9864b070acc3fec95e25bcf1e22c84928cbcea (diff)
downloadgitlab-ce-gitlab-git-remote-repository.tar.gz
-rw-r--r--lib/gitlab/git/remote_repository.rb17
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