diff options
author | Jacob Vosmaer <jacob@gitlab.com> | 2017-11-10 14:24:38 +0100 |
---|---|---|
committer | Jacob Vosmaer <jacob@gitlab.com> | 2017-11-10 14:24:38 +0100 |
commit | da3b51bce67351b8101162c57e3c6520be228990 (patch) | |
tree | b9b0543ca71bfd10d2dafc0e8a1d46cdff7002b8 | |
parent | 6e9864b070acc3fec95e25bcf1e22c84928cbcea (diff) | |
download | gitlab-ce-gitlab-git-remote-repository.tar.gz |
More commentsgitlab-git-remote-repository
-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 |