Commit e5bbefc98025b1b9f67b8635807d43f60be55c30

Authored by Demelziraptor
1 parent 1b85cbc6

change find_or_first to work with default branch

app/models/commit.rb
... ... @@ -23,11 +23,11 @@ class Commit
23 23  
24 24  
25 25 class << self
26   - def find_or_first(repo, commit_id = nil)
  26 + def find_or_first(repo, commit_id = nil, root_ref)
27 27 commit = if commit_id
28 28 repo.commit(commit_id)
29 29 else
30   - repo.commits.first
  30 + repo.commits(root_ref).first
31 31 end
32 32 Commit.new(commit) if commit
33 33 end
... ...
app/models/project/repository_trait.rb
... ... @@ -8,7 +8,7 @@ module Project::RepositoryTrait
8 8 end
9 9  
10 10 def commit(commit_id = nil)
11   - Commit.find_or_first(repo, commit_id)
  11 + Commit.find_or_first(repo, commit_id, root_ref)
12 12 end
13 13  
14 14 def fresh_commits(n = 10)
... ...