Merge branch 'feature/fix-14753' into 'master'

Fix #14753: Check if head is born before trying to detect main language

This MR makes sure that head exists before trying to detect the main language.
This prevents errors on repo's without a master branch.

Closes #14753

See merge request !3654
This commit is contained in:
Rémy Coutable 2016-04-12 15:34:56 +00:00
commit d65d5c2d1a
2 changed files with 6 additions and 3 deletions

View File

@ -43,6 +43,9 @@ v 8.7.0 (unreleased)
- API: Expose 'updated_at' for issue, snippet, and merge request notes (Robert Schilling)
- API: User can leave a project through the API when not master or owner. !3613
v 8.6.6
- Fix error on language detection when repository has no HEAD (e.g., master branch). !3654 (Jeroen Bobbeldijk)
v 8.6.5
- Fix importing from GitHub Enterprise. !3529
- Perform the language detection after updating merge requests in `GitPushService`, leading to faster visual feedback for the end-user. !3533

View File

@ -896,9 +896,9 @@ class Repository
end
def main_language
unless empty?
Linguist::Repository.new(rugged, rugged.head.target_id).language
end
return if empty? || rugged.head_unborn?
Linguist::Repository.new(rugged, rugged.head.target_id).language
end
def avatar