// LateInitialize fills the empty fields of RepositoryParameters if the corresponding
// fields are given in Repository.
LateInitialize fills the empty fields of RepositoryParameters if the corresponding
fields are given in Repository.
// LateInitialize fills the empty fields of RepositoryParameters if the corresponding // fields are given in Repository .
func LateInitialize(rp *v1alpha1.RepositoryParameters, r *github.Repository, c xpv1.Condition) { 
	if rp.Organization == nil && ghclient.StringValue(r.Owner.Type) == "Organization" {
		if r.Organization.Login != nil {
			rp.Organization = r.Organization.Login
		}
	}
	if rp.Description == nil && r.Description != nil {
		rp.Description = r.Description
	}
	if rp.Homepage == nil && r.Homepage != nil {
		rp.Homepage = r.Homepage
	}
	if rp.Private == nil && r.Private != nil {
		rp.Private = r.Private
	}
	if rp.Visibility == nil && r.Visibility != nil {
		rp.Visibility = r.Visibility
	}
	if rp.HasIssues == nil && r.HasIssues != nil {
		rp.HasIssues = r.HasIssues
	}
	if rp.HasProjects == nil && r.HasProjects != nil {
		rp.HasProjects = r.HasProjects
	}
	if rp.HasWiki == nil && r.HasWiki != nil {
		rp.HasWiki = r.HasWiki
	}
	if rp.IsTemplate == nil && r.IsTemplate != nil {
		rp.IsTemplate = r.IsTemplate
	}
	if rp.TeamID == nil && r.TeamID != nil {
		rp.TeamID = r.TeamID
	}
	if rp.AutoInit == nil && r.AutoInit != nil {
		rp.AutoInit = r.AutoInit
	}
	if rp.GitignoreTemplate == nil && r.GitignoreTemplate != nil {
		rp.GitignoreTemplate = r.GitignoreTemplate
	}
	if rp.LicenseTemplate == nil && r.LicenseTemplate != nil {
		rp.LicenseTemplate = r.LicenseTemplate
	}
	if rp.AllowSquashMerge == nil && r.AllowSquashMerge != nil {
		rp.AllowSquashMerge = r.AllowSquashMerge
	}
	if rp.AllowMergeCommit == nil && r.AllowMergeCommit != nil {
		rp.AllowMergeCommit = r.AllowMergeCommit
	}
	if rp.AllowRebaseMerge == nil && r.AllowRebaseMerge != nil {
		rp.AllowRebaseMerge = r.AllowRebaseMerge
	}
	if rp.DeleteBranchOnMerge == nil && r.DeleteBranchOnMerge != nil {
		rp.DeleteBranchOnMerge = r.DeleteBranchOnMerge
	}
	if rp.HasPages == nil && r.HasPages != nil {
		rp.HasPages = r.HasPages
	}
	if rp.HasDownloads == nil && r.HasDownloads != nil {
		rp.HasDownloads = r.HasDownloads
	}
	if rp.Archived == nil && r.Archived != nil {
		rp.Archived = r.Archived
	}
	if r.TemplateRepository != nil {
		rp.Template = &xpv1.Reference{
			Name: *r.TemplateRepository.FullName,
		}
	}
	if c.Reason == xpv1.ReasonCreating && r.TemplateRepository != nil {
		if rp.DefaultBranch == nil {
			rp.DefaultBranch = r.TemplateRepository.DefaultBranch
			r.DefaultBranch = r.TemplateRepository.DefaultBranch
		}
	} else {
		if rp.DefaultBranch == nil && r.DefaultBranch != nil {
			rp.DefaultBranch = r.DefaultBranch
		}
	}
}
func LateInitialize ( rp * v1alpha1 . RepositoryParameters , r * github . Repository , c xpv1 . Condition ) { if rp . Organization == nil && ghclient . StringValue ( r . Owner . Type ) == " " { if r . Organization . Login != nil { rp . Organization = r . Organization . Login } } if rp . Description == nil && r . Description != nil { rp . Description = r . Description } if rp . Homepage == nil && r . Homepage != nil { rp . Homepage = r . Homepage } if rp . Private == nil && r . Private != nil { rp . Private = r . Private } if rp . Visibility == nil && r . Visibility != nil { rp . Visibility = r . Visibility } if rp . HasIssues == nil && r . HasIssues != nil { rp . HasIssues = r . HasIssues } if rp . HasProjects == nil && r . HasProjects != nil { rp . HasProjects = r . HasProjects } if rp . HasWiki == nil && r . HasWiki != nil { rp . HasWiki = r . HasWiki } if rp . IsTemplate == nil && r . IsTemplate != nil { rp . IsTemplate = r . IsTemplate } if rp . TeamID == nil && r . TeamID != nil { rp . TeamID = r . TeamID } if rp . AutoInit == nil && r . AutoInit != nil { rp . AutoInit = r . AutoInit } if rp . GitignoreTemplate == nil && r . GitignoreTemplate != nil { rp . GitignoreTemplate = r . GitignoreTemplate } if rp . LicenseTemplate == nil && r . LicenseTemplate != nil { rp . LicenseTemplate = r . LicenseTemplate } if rp . AllowSquashMerge == nil && r . AllowSquashMerge != nil { rp . AllowSquashMerge = r . AllowSquashMerge } if rp . AllowMergeCommit == nil && r . AllowMergeCommit != nil { rp . AllowMergeCommit = r . AllowMergeCommit } if rp . AllowRebaseMerge == nil && r . AllowRebaseMerge != nil { rp . AllowRebaseMerge = r . AllowRebaseMerge } if rp . DeleteBranchOnMerge == nil && r . DeleteBranchOnMerge != nil { rp . DeleteBranchOnMerge = r . DeleteBranchOnMerge } if rp . HasPages == nil && r . HasPages != nil { rp . HasPages = r . HasPages } if rp . HasDownloads == nil && r . HasDownloads != nil { rp . HasDownloads = r . HasDownloads } if rp . Archived == nil && r . Archived != nil { rp . Archived = r . Archived } if r . TemplateRepository != nil { rp . Template = & xpv1 . Reference { Name : * r . TemplateRepository . FullName , } } if c . Reason == xpv1 . ReasonCreating && r . TemplateRepository != nil { if rp . DefaultBranch == nil { rp . DefaultBranch = r . TemplateRepository . DefaultBranch r . DefaultBranch = r . TemplateRepository . DefaultBranch } } else { if rp . DefaultBranch == nil && r . DefaultBranch != nil { rp . DefaultBranch = r . DefaultBranch } } }
LateInitialize fills the empty fields of RepositoryParameters if the corresponding
fields are given in Repository.
LateInitialize fills the empty fields of RepositoryParameters if the corresponding fields are given in Repository .
// nolint:gocyclo // This condition below is necessary because the GitHub API is not strongly // consistent. In the first moments of creating a repository based on a // template, the API always returns that the default branch is "main", then // it is changed to the same default branch as the template. This can cause // inconsistency in the desired state of the Repository (importing the wrong // value into the default branch). // We change the r.DefaultBranch to have consistency when checking // if the repository is up to date.