{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings options")}}

{{ctx.Locale.Tr "repo.settings.basic_settings"}}

{{template "base/disable_form_autofill"}} {{.CsrfTokenHtml}}
{{FileSize .Repository.Size}}
{{if not .Repository.IsFork}}
{{if .IsAdmin}} {{else}} {{end}}
{{end}}
{{.CsrfTokenHtml}}
{{/* These variables exist to make the logic in the Settings window easier to comprehend and are not used later on. */}} {{$newMirrorsPartiallyEnabled := or (not .DisableNewPullMirrors) (not .DisableNewPushMirrors)}} {{/* .Repository.IsMirror is not always reliable if the repository is not actively acting as a mirror because of errors. */}} {{$showMirrorSettings := and (.Repository.UnitEnabled $.Context $.UnitTypeCode) (or $newMirrorsPartiallyEnabled .Repository.IsMirror .PullMirror .PushMirrors)}} {{$newMirrorsEntirelyEnabled := and (not .DisableNewPullMirrors) (not .DisableNewPushMirrors)}} {{$onlyNewPushMirrorsEnabled := and (not .DisableNewPushMirrors) .DisableNewPullMirrors}} {{$onlyNewPullMirrorsEnabled := and .DisableNewPushMirrors (not .DisableNewPullMirrors)}} {{$existingPushMirror := or .Repository.IsMirror .PushMirrors}} {{$modifyBrokenPullMirror := and .Repository.IsMirror (not .PullMirror)}} {{$isWorkingPullMirror := .PullMirror}} {{if $showMirrorSettings}}

{{ctx.Locale.Tr "repo.settings.mirror_settings"}}

{{if .Repository.IsArchived}}
{{ctx.Locale.Tr "repo.settings.archive.mirrors_unavailable"}}
{{else}} {{if $newMirrorsEntirelyEnabled}} {{ctx.Locale.Tr "repo.settings.mirror_settings.docs"}} {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.doc_link_title"}}

{{ctx.Locale.Tr "repo.settings.mirror_settings.docs.pull_mirror_instructions"}} {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.doc_link_pull_section"}}
{{else if $onlyNewPushMirrorsEnabled}} {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.disabled_pull_mirror.instructions"}} {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.more_information_if_disabled"}} {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.doc_link_title"}}
{{else if $onlyNewPullMirrorsEnabled}} {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.disabled_push_mirror.instructions"}} {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.disabled_push_mirror.pull_mirror_warning"}} {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.more_information_if_disabled"}} {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.doc_link_title"}}

{{ctx.Locale.Tr "repo.settings.mirror_settings.docs.disabled_push_mirror.info"}} {{if $existingPushMirror}} {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.can_still_use"}} {{end}} {{else}} {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.no_new_mirrors"}} {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.can_still_use"}}
{{end}} {{if $existingPushMirror}} {{end}} {{if $modifyBrokenPullMirror}} {{/* even if a repo is a pull mirror (IsMirror=true), the PullMirror might still be nil if the mirror migration is broken */}} {{else if $isWorkingPullMirror}} {{end}}{{/* end if: IsMirror */}} {{range .PushMirrors}} {{else}} {{end}} {{if (not .DisableNewPushMirrors)}} {{end}}
{{ctx.Locale.Tr "repo.settings.mirror_settings.mirrored_repository"}} {{ctx.Locale.Tr "repo.settings.mirror_settings.direction"}} {{ctx.Locale.Tr "repo.settings.mirror_settings.last_update"}}
{{ctx.Locale.Tr "repo.settings.mirror_settings.direction.pull"}}: {{ctx.Locale.Tr "error.occurred"}}
{{.PullMirror.RemoteAddress}} {{ctx.Locale.Tr "repo.settings.mirror_settings.direction.pull"}} {{DateTime "full" .PullMirror.UpdatedUnix}}
{{.CsrfTokenHtml}}
{{template "base/disable_form_autofill"}} {{.CsrfTokenHtml}}
{{$address := MirrorRemoteAddress $.Context .Repository .PullMirror.GetRemoteName false}}

{{ctx.Locale.Tr "repo.mirror_address_desc"}}

{{ctx.Locale.Tr "repo.need_auth"}}

{{ctx.Locale.Tr "repo.mirror_password_help"}}

{{if .LFSStartServer}}

{{ctx.Locale.Tr "repo.mirror_lfs_endpoint_desc" "https://github.com/git-lfs/git-lfs/blob/main/docs/api/server-discovery.md#server-discovery" | Str2html}}

{{end}}
{{.RemoteAddress}} {{ctx.Locale.Tr "repo.settings.mirror_settings.direction.push"}} {{if .LastUpdateUnix}}{{DateTime "full" .LastUpdateUnix}}{{else}}{{ctx.Locale.Tr "never"}}{{end}} {{if .LastError}}
{{ctx.Locale.Tr "error"}}
{{end}}
{{$.CsrfTokenHtml}}
{{$.CsrfTokenHtml}}
{{ctx.Locale.Tr "repo.settings.mirror_settings.push_mirror.none"}}
{{template "base/disable_form_autofill"}} {{.CsrfTokenHtml}}

{{ctx.Locale.Tr "repo.mirror_address_desc"}}

{{ctx.Locale.Tr "repo.need_auth"}}
{{end}}
{{end}}

{{ctx.Locale.Tr "repo.settings.advanced_settings"}}

{{.CsrfTokenHtml}} {{$isCodeEnabled := .Repository.UnitEnabled $.Context $.UnitTypeCode}} {{$isCodeGlobalDisabled := .UnitTypeCode.UnitGlobalDisabled}}
{{$isWikiEnabled := or (.Repository.UnitEnabled $.Context $.UnitTypeWiki) (.Repository.UnitEnabled $.Context $.UnitTypeExternalWiki)}} {{$isWikiGlobalDisabled := .UnitTypeWiki.UnitGlobalDisabled}} {{$isExternalWikiGlobalDisabled := .UnitTypeExternalWiki.UnitGlobalDisabled}} {{$isBothWikiGlobalDisabled := and $isWikiGlobalDisabled $isExternalWikiGlobalDisabled}}
{{if (not .Repository.IsPrivate)}}
{{end}}

{{ctx.Locale.Tr "repo.settings.external_wiki_url_desc"}}

{{$isIssuesEnabled := or (.Repository.UnitEnabled $.Context $.UnitTypeIssues) (.Repository.UnitEnabled $.Context $.UnitTypeExternalTracker)}} {{$isIssuesGlobalDisabled := .UnitTypeIssues.UnitGlobalDisabled}} {{$isExternalTrackerGlobalDisabled := .UnitTypeExternalTracker.UnitGlobalDisabled}} {{$isIssuesAndExternalGlobalDisabled := and $isIssuesGlobalDisabled $isExternalTrackerGlobalDisabled}}
{{if .Repository.CanEnableTimetracker}}
{{end}}

{{ctx.Locale.Tr "repo.settings.external_tracker_url_desc"}}

{{ctx.Locale.Tr "repo.settings.tracker_url_format_desc" | Str2html}}

{{$externalTracker := (.Repository.MustGetUnit $.Context $.UnitTypeExternalTracker)}} {{$externalTrackerStyle := $externalTracker.ExternalTrackerConfig.ExternalTrackerStyle}}

{{ctx.Locale.Tr "repo.settings.tracker_issue_style.regexp_pattern_desc" | Str2html}}

{{$isProjectsEnabled := .Repository.UnitEnabled $.Context $.UnitTypeProjects}} {{$isProjectsGlobalDisabled := .UnitTypeProjects.UnitGlobalDisabled}}
{{$isReleasesEnabled := .Repository.UnitEnabled $.Context $.UnitTypeReleases}} {{$isReleasesGlobalDisabled := .UnitTypeReleases.UnitGlobalDisabled}}
{{$isPackagesEnabled := .Repository.UnitEnabled $.Context $.UnitTypePackages}} {{$isPackagesGlobalDisabled := .UnitTypePackages.UnitGlobalDisabled}}
{{if .EnableActions}} {{$isActionsEnabled := .Repository.UnitEnabled $.Context $.UnitTypeActions}} {{$isActionsGlobalDisabled := .UnitTypeActions.UnitGlobalDisabled}}
{{end}} {{if not .IsMirror}}
{{$pullRequestEnabled := .Repository.UnitEnabled $.Context $.UnitTypePullRequests}} {{$pullRequestGlobalDisabled := .UnitTypePullRequests.UnitGlobalDisabled}} {{$prUnit := .Repository.MustGetUnit $.Context $.UnitTypePullRequests}}

{{ctx.Locale.Tr "repo.settings.merge_style_desc"}}

{{ctx.Locale.Tr "repo.settings.default_merge_style_desc"}}

{{end}}

{{ctx.Locale.Tr "repo.settings.signing_settings"}}

{{.CsrfTokenHtml}}

{{ctx.Locale.Tr "repo.settings.trust_model.default.desc"}}

{{ctx.Locale.Tr "repo.settings.trust_model.collaborator.desc"}}

{{ctx.Locale.Tr "repo.settings.trust_model.committer.desc"}}

{{ctx.Locale.Tr "repo.settings.trust_model.collaboratorcommitter.desc"}}

{{if .IsAdmin}}

{{ctx.Locale.Tr "repo.settings.admin_settings"}}

{{.CsrfTokenHtml}}
{{.CsrfTokenHtml}} {{if .CodeIndexerEnabled}}

{{ctx.Locale.Tr "repo.settings.admin_code_indexer"}}

{{if .CodeIndexerStatus}} {{ShortSha .CodeIndexerStatus.CommitSha}} {{else}} {{ctx.Locale.Tr "repo.settings.admin_indexer_unindexed"}} {{end}}
{{end}}

{{ctx.Locale.Tr "repo.settings.admin_stats_indexer"}}

{{if and .StatsIndexerStatus .StatsIndexerStatus.CommitSha}} {{end}} {{if and .StatsIndexerStatus .StatsIndexerStatus.CommitSha}} {{ShortSha .StatsIndexerStatus.CommitSha}} {{else}} {{ctx.Locale.Tr "repo.settings.admin_indexer_unindexed"}} {{end}}
{{end}} {{if .Permission.IsOwner}}

{{ctx.Locale.Tr "repo.settings.danger_zone"}}

{{if .Repository.IsMirror}}
{{ctx.Locale.Tr "repo.settings.convert"}}
{{ctx.Locale.Tr "repo.settings.convert_desc"}}
{{end}} {{if and .Repository.IsFork .Repository.Owner.CanCreateRepo}}
{{ctx.Locale.Tr "repo.settings.convert_fork"}}
{{ctx.Locale.Tr "repo.settings.convert_fork_desc"}}
{{end}}
{{ctx.Locale.Tr "repo.settings.transfer"}}
{{if .RepoTransfer}} {{ctx.Locale.Tr "repo.settings.transfer_started" .RepoTransfer.Recipient.DisplayName}} {{else}} {{ctx.Locale.Tr "repo.settings.transfer_desc"}} {{end}}
{{if .RepoTransfer}}
{{.CsrfTokenHtml}}
{{else}} {{end}}
{{if .Permission.CanRead $.UnitTypeWiki}} {{if ne $.Repository.GetWikiBranchName .DefaultWikiBranchName}}
{{ctx.Locale.Tr "repo.settings.wiki_rename_branch_main"}}
{{ctx.Locale.Tr "repo.settings.wiki_rename_branch_main_desc" .DefaultWikiBranchName}}
{{end}}
{{ctx.Locale.Tr "repo.settings.wiki_delete"}}
{{ctx.Locale.Tr "repo.settings.wiki_delete_desc"}}
{{end}}
{{ctx.Locale.Tr "repo.settings.delete"}}
{{ctx.Locale.Tr "repo.settings.delete_desc"}}
{{if not .Repository.IsMirror}}
{{if .Repository.IsArchived}}
{{ctx.Locale.Tr "repo.settings.unarchive.header"}}
{{ctx.Locale.Tr "repo.settings.unarchive.text"}}
{{else}}
{{ctx.Locale.Tr "repo.settings.archive.header"}}
{{ctx.Locale.Tr "repo.settings.archive.text"}}
{{end}}
{{end}}
{{end}}
{{template "repo/settings/layout_footer" .}} {{if .Permission.IsOwner}} {{if .Repository.IsMirror}} {{end}} {{if and .Repository.IsFork .Repository.Owner.CanCreateRepo}} {{end}} {{if .Repository.UnitEnabled $.Context $.UnitTypeWiki}} {{if ne $.Repository.GetWikiBranchName .DefaultWikiBranchName}} {{end}} {{end}} {{if not .Repository.IsMirror}} {{end}} {{end}} {{template "repo/settings/push_mirror_sync_modal" .}}