change find_or_first to work with default branch
This commit is contained in:
parent
1b85cbc6d6
commit
e5bbefc980
2 changed files with 3 additions and 3 deletions
|
@ -23,11 +23,11 @@ class Commit
|
||||||
|
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
def find_or_first(repo, commit_id = nil)
|
def find_or_first(repo, commit_id = nil, root_ref)
|
||||||
commit = if commit_id
|
commit = if commit_id
|
||||||
repo.commit(commit_id)
|
repo.commit(commit_id)
|
||||||
else
|
else
|
||||||
repo.commits.first
|
repo.commits(root_ref).first
|
||||||
end
|
end
|
||||||
Commit.new(commit) if commit
|
Commit.new(commit) if commit
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,7 +8,7 @@ module Project::RepositoryTrait
|
||||||
end
|
end
|
||||||
|
|
||||||
def commit(commit_id = nil)
|
def commit(commit_id = nil)
|
||||||
Commit.find_or_first(repo, commit_id)
|
Commit.find_or_first(repo, commit_id, root_ref)
|
||||||
end
|
end
|
||||||
|
|
||||||
def fresh_commits(n = 10)
|
def fresh_commits(n = 10)
|
||||||
|
|
Loading…
Reference in a new issue