{{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}}
{{.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 ctx ctx.Consts.RepoUnitTypeCode) (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 .Repository.IsMirror}} {{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: $modifyBrokenPullMirror / $isWorkingPullMirror */}}
{{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"}} {{DateUtils.FullTime .PullMirror.UpdatedUnix}}
{{.CsrfTokenHtml}}
{{template "base/disable_form_autofill"}} {{.CsrfTokenHtml}}
{{$address := MirrorRemoteAddress ctx .Repository .PullMirror.GetRemoteName}}

{{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"}}

{{end}}
{{end}}{{/* end if .Repository.IsMirror */}} {{range .PushMirrors}} {{else}} {{end}} {{if (not .DisableNewPushMirrors)}} {{end}}
{{ctx.Locale.Tr "repo.settings.mirror_settings.pushed_repository"}} {{ctx.Locale.Tr "repo.settings.mirror_settings.direction"}} {{ctx.Locale.Tr "repo.settings.mirror_settings.last_update"}}
{{.RemoteAddress}} {{ctx.Locale.Tr "repo.settings.mirror_settings.direction.push"}} {{if .LastUpdateUnix}}{{DateUtils.FullTime .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 ctx ctx.Consts.RepoUnitTypeCode}} {{$isCodeGlobalDisabled := ctx.Consts.RepoUnitTypeCode.UnitGlobalDisabled}}
{{$isInternalWikiEnabled := .Repository.UnitEnabled ctx ctx.Consts.RepoUnitTypeWiki}} {{$isExternalWikiEnabled := .Repository.UnitEnabled ctx ctx.Consts.RepoUnitTypeExternalWiki}} {{$isWikiEnabled := or $isInternalWikiEnabled $isExternalWikiEnabled}} {{$isWikiGlobalDisabled := ctx.Consts.RepoUnitTypeWiki.UnitGlobalDisabled}} {{$isExternalWikiGlobalDisabled := ctx.Consts.RepoUnitTypeExternalWiki.UnitGlobalDisabled}} {{$isBothWikiGlobalDisabled := and $isWikiGlobalDisabled $isExternalWikiGlobalDisabled}}
{{$unitInternalWiki := .Repository.MustGetUnit ctx ctx.Consts.RepoUnitTypeWiki}}

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

{{$isIssuesEnabled := or (.Repository.UnitEnabled ctx ctx.Consts.RepoUnitTypeIssues) (.Repository.UnitEnabled ctx ctx.Consts.RepoUnitTypeExternalTracker)}} {{$isIssuesGlobalDisabled := ctx.Consts.RepoUnitTypeIssues.UnitGlobalDisabled}} {{$isExternalTrackerGlobalDisabled := ctx.Consts.RepoUnitTypeExternalTracker.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"}}

{{$externalTracker := (.Repository.MustGetUnit ctx ctx.Consts.RepoUnitTypeExternalTracker)}} {{$externalTrackerStyle := $externalTracker.ExternalTrackerConfig.ExternalTrackerStyle}}

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

{{$isProjectsEnabled := .Repository.UnitEnabled ctx ctx.Consts.RepoUnitTypeProjects}} {{$isProjectsGlobalDisabled := ctx.Consts.RepoUnitTypeProjects.UnitGlobalDisabled}} {{$projectsUnit := .Repository.MustGetUnit ctx ctx.Consts.RepoUnitTypeProjects}}

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

{{$isReleasesEnabled := .Repository.UnitEnabled ctx ctx.Consts.RepoUnitTypeReleases}} {{$isReleasesGlobalDisabled := ctx.Consts.RepoUnitTypeReleases.UnitGlobalDisabled}}
{{$isPackagesEnabled := .Repository.UnitEnabled ctx ctx.Consts.RepoUnitTypePackages}} {{$isPackagesGlobalDisabled := ctx.Consts.RepoUnitTypePackages.UnitGlobalDisabled}}
{{if .EnableActions}} {{$isActionsEnabled := .Repository.UnitEnabled ctx ctx.Consts.RepoUnitTypeActions}} {{$isActionsGlobalDisabled := ctx.Consts.RepoUnitTypeActions.UnitGlobalDisabled}}
{{end}} {{if not .IsMirror}}
{{$pullRequestEnabled := .Repository.UnitEnabled ctx ctx.Consts.RepoUnitTypePullRequests}} {{$pullRequestGlobalDisabled := ctx.Consts.RepoUnitTypePullRequests.UnitGlobalDisabled}} {{$prUnit := .Repository.MustGetUnit ctx ctx.Consts.RepoUnitTypePullRequests}}

{{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 .IsRepoIndexerEnabled}}

{{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 not .Repository.IsFork}}
{{ctx.Locale.Tr "repo.visibility"}}
{{if .Repository.IsPrivate}}
{{ctx.Locale.Tr "repo.settings.visibility.public.text"}}
{{else}}
{{ctx.Locale.Tr "repo.settings.visibility.private.text"}}
{{end}}
{{end}} {{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 ctx.Consts.RepoUnitTypeWiki}}
{{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 not .Repository.IsFork}} {{end}} {{if .Repository.UnitEnabled ctx ctx.Consts.RepoUnitTypeWiki}} {{end}} {{if not .Repository.IsMirror}} {{end}} {{end}} {{template "repo/settings/push_mirror_sync_modal" .}}