diff --git a/app/models/commit.rb b/app/models/commit.rb index 263e2f74296caf2d27981f885332c3aaf6910315..574f69bc213a49d4528587053948bcc8bfcd1c42 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -23,11 +23,11 @@ class Commit class << self - def find_or_first(repo, commit_id = nil) + def find_or_first(repo, commit_id = nil, root_ref) commit = if commit_id repo.commit(commit_id) else - repo.commits.first + repo.commits(root_ref).first end Commit.new(commit) if commit end diff --git a/app/models/project/repository_trait.rb b/app/models/project/repository_trait.rb index d8bdbf2403b6be3a03d4c5e99179313115ebb7e6..8757d84421777544bc22d46f05bb92e1e7fb3746 100644 --- a/app/models/project/repository_trait.rb +++ b/app/models/project/repository_trait.rb @@ -8,7 +8,7 @@ module Project::RepositoryTrait end def commit(commit_id = nil) - Commit.find_or_first(repo, commit_id) + Commit.find_or_first(repo, commit_id, root_ref) end def fresh_commits(n = 10)