From e5bbefc98025b1b9f67b8635807d43f60be55c30 Mon Sep 17 00:00:00 2001 From: Demelziraptor Date: Wed, 16 May 2012 14:34:10 +0100 Subject: [PATCH] change find_or_first to work with default branch --- app/models/commit.rb | 4 ++-- app/models/project/repository_trait.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/commit.rb b/app/models/commit.rb index 263e2f74..574f69bc 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 d8bdbf24..8757d844 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)