mirror of
https://github.com/go-gitea/gitea
synced 2024-11-18 07:52:03 +01:00
#1206 does not allow fork bare repo
This commit is contained in:
parent
398569f6f8
commit
670ade9a61
3 changed files with 12 additions and 1 deletions
|
@ -33,6 +33,13 @@ func getForkRepository(ctx *middleware.Context) *models.Repository {
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Cannot fork bare repo.
|
||||||
|
if forkRepo.IsBare {
|
||||||
|
ctx.Handle(404, "", nil)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
ctx.Data["repo_name"] = forkRepo.Name
|
ctx.Data["repo_name"] = forkRepo.Name
|
||||||
ctx.Data["desc"] = forkRepo.Description
|
ctx.Data["desc"] = forkRepo.Description
|
||||||
ctx.Data["IsPrivate"] = forkRepo.IsPrivate
|
ctx.Data["IsPrivate"] = forkRepo.IsPrivate
|
||||||
|
|
|
@ -2,13 +2,15 @@
|
||||||
<div class="ui container"><!-- start container -->
|
<div class="ui container"><!-- start container -->
|
||||||
<div class="ui vertically padded grid head"><!-- start grid -->
|
<div class="ui vertically padded grid head"><!-- start grid -->
|
||||||
<div class="column"><!-- start column -->
|
<div class="column"><!-- start column -->
|
||||||
|
{{if not .IsBare}}
|
||||||
<div class="ui black small compact menu floated right count labelled">
|
<div class="ui black small compact menu floated right count labelled">
|
||||||
<a class="item{{if $.IsRepositoryOwner}} poping up{{end}}"{{if not $.IsRepositoryOwner}} href="{{AppSubUrl}}/repo/fork/{{.ID}}"{{else}} data-content="{{$.i18n.Tr "repo.fork_from_self"}}" data-position="top center" data-variation="tiny"{{end}}>
|
<a class="item{{if eq .OwnerID $.SignedUserID}} poping up{{end}}"{{if not (eq .OwnerID $.SignedUserID)}} href="{{AppSubUrl}}/repo/fork/{{.ID}}"{{else}} data-content="{{$.i18n.Tr "repo.fork_from_self"}}" data-position="top center" data-variation="tiny"{{end}}>
|
||||||
<i class="icon octicon octicon-repo-forked"></i>
|
<i class="icon octicon octicon-repo-forked"></i>
|
||||||
{{$.i18n.Tr "repo.fork"}}
|
{{$.i18n.Tr "repo.fork"}}
|
||||||
</a>
|
</a>
|
||||||
<span class="active item num">{{.NumForks}}</span>
|
<span class="active item num">{{.NumForks}}</span>
|
||||||
</div>
|
</div>
|
||||||
|
{{end}}
|
||||||
|
|
||||||
<div class="ui black small compact menu floated right count labelled">
|
<div class="ui black small compact menu floated right count labelled">
|
||||||
<a class="item" href="{{$.RepoLink}}/action/{{if $.IsStaringRepo}}un{{end}}star?redirect_to={{$.Link}}">
|
<a class="item" href="{{$.RepoLink}}/action/{{if $.IsStaringRepo}}un{{end}}star?redirect_to={{$.Link}}">
|
||||||
|
|
|
@ -48,6 +48,7 @@
|
||||||
</button>
|
</button>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
{{if not .IsBare}}
|
||||||
<li id="repo-header-fork">
|
<li id="repo-header-fork">
|
||||||
<a id="repo-header-fork-btn" {{if or (not $.IsRepositoryAdmin) $.Owner.IsOrganization}}href="{{AppSubUrl}}/repo/fork/{{.ID}}"{{end}}>
|
<a id="repo-header-fork-btn" {{if or (not $.IsRepositoryAdmin) $.Owner.IsOrganization}}href="{{AppSubUrl}}/repo/fork/{{.ID}}"{{end}}>
|
||||||
<button class="btn btn-gray text-bold btn-radius">
|
<button class="btn btn-gray text-bold btn-radius">
|
||||||
|
@ -57,6 +58,7 @@
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
|
{{end}}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue