diff --git a/lib/travis/api/v3/models/branch.rb b/lib/travis/api/v3/models/branch.rb index fa0a00ef..df66788e 100644 --- a/lib/travis/api/v3/models/branch.rb +++ b/lib/travis/api/v3/models/branch.rb @@ -4,5 +4,9 @@ module Travis::API::V3 belongs_to :last_build, class_name: 'Travis::API::V3::Models::Build'.freeze has_many :builds, foreign_key: [:repository_id, :branch], primary_key: [:repository_id, :name], order: 'builds.id DESC'.freeze, conditions: { event_type: 'push' } has_many :commits, foreign_key: [:repository_id, :branch], primary_key: [:repository_id, :name], order: 'commits.id DESC'.freeze + + def default_branch + name == repository.default_branch_name + end end end diff --git a/lib/travis/api/v3/renderer/branch.rb b/lib/travis/api/v3/renderer/branch.rb index 25374604..fb272db4 100644 --- a/lib/travis/api/v3/renderer/branch.rb +++ b/lib/travis/api/v3/renderer/branch.rb @@ -2,7 +2,7 @@ require 'travis/api/v3/renderer/model_renderer' module Travis::API::V3 class Renderer::Branch < Renderer::ModelRenderer - representation(:minimal, :name, :last_build) - representation(:standard, :name, :repository, :last_build, :exists_on_github) + representation(:minimal, :name) + representation(:standard, :name, :repository, :default_branch, :exists_on_github, :last_build) end end