Skip to content

Commit 8f17121

Browse files
Bwkolunny
authored andcommitted
Revert "Add ability to fork your own repos (#761)" (#2193)
1 parent 48898e5 commit 8f17121

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

options/locale/locale_en-US.ini

+1
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,7 @@ migrate.lfs_mirror_unsupported = Mirroring LFS objects is not supported - use 'g
492492
493493
mirror_from = mirror of
494494
forked_from = forked from
495+
fork_from_self = You cannot fork a repository you already own!
495496
copy_link = Copy
496497
copy_link_success = Copied!
497498
copy_link_error = Press ⌘-C or Ctrl-C to copy

routers/repo/pull.go

+6
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,12 @@ func ForkPost(ctx *context.Context, form auth.CreateRepoForm) {
111111
return
112112
}
113113

114+
repo, has := models.HasForkedRepo(ctxUser.ID, forkRepo.ID)
115+
if has {
116+
ctx.Redirect(setting.AppSubURL + "/" + ctxUser.Name + "/" + repo.Name)
117+
return
118+
}
119+
114120
// Check ownership of organization.
115121
if ctxUser.IsOrganization() {
116122
if !ctxUser.IsOwnedBy(ctx.User.ID) {

templates/repo/header.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
</div>
3333
{{if .CanBeForked}}
3434
<div class="ui compact labeled button" tabindex="0">
35-
<a class="ui compact button" href="{{AppSubUrl}}/repo/fork/{{.ID}}">
35+
<a class="ui compact button {{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}}>
3636
<i class="octicon octicon-repo-forked"></i>{{$.i18n.Tr "repo.fork"}}
3737
</a>
3838
<a class="ui basic label" href="{{.Link}}/forks">

0 commit comments

Comments
 (0)