Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-04-21 16:09:15 +0300
committerDouwe Maan <douwe@gitlab.com>2015-04-24 13:29:36 +0300
commit84a1590252c63c710bceaa7a394799cdc5109505 (patch)
tree12d9b499acad48dc9420d095803705093d2b135d /app/models/repository.rb
parentb0ed2ff1a69df384a1cb9a184c0528bec1986827 (diff)
Let commit model know about its project.
Diffstat (limited to 'app/models/repository.rb')
-rw-r--r--app/models/repository.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 263a436d521..1b8c74028d9 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -1,11 +1,12 @@
class Repository
include Gitlab::ShellAdapter
- attr_accessor :raw_repository, :path_with_namespace
+ attr_accessor :raw_repository, :path_with_namespace, :project
- def initialize(path_with_namespace, default_branch = nil)
+ def initialize(path_with_namespace, default_branch = nil, project = nil)
@path_with_namespace = path_with_namespace
@raw_repository = Gitlab::Git::Repository.new(path_to_repo) if path_with_namespace
+ @project = project
rescue Gitlab::Git::Repository::NoRepository
nil
end
@@ -28,7 +29,7 @@ class Repository
def commit(id = 'HEAD')
return nil unless raw_repository
commit = Gitlab::Git::Commit.find(raw_repository, id)
- commit = Commit.new(commit) if commit
+ commit = Commit.new(commit, @project) if commit
commit
rescue Rugged::OdbError
nil
@@ -42,13 +43,13 @@ class Repository
limit: limit,
offset: offset,
)
- commits = Commit.decorate(commits) if commits.present?
+ commits = Commit.decorate(commits, @project) if commits.present?
commits
end
def commits_between(from, to)
commits = Gitlab::Git::Commit.between(raw_repository, from, to)
- commits = Commit.decorate(commits) if commits.present?
+ commits = Commit.decorate(commits, @project) if commits.present?
commits
end