]> source.dussan.org Git - gitea.git/commitdiff
#1206 does not allow fork bare repo
authorUnknwon <u@gogs.io>
Tue, 1 Sep 2015 15:57:02 +0000 (11:57 -0400)
committerUnknwon <u@gogs.io>
Tue, 1 Sep 2015 15:57:02 +0000 (11:57 -0400)
routers/repo/pull.go
templates/repo/header.tmpl
templates/repo/header_old.tmpl

index d2aea3d27afccbfa59e3fbdfcfbddc51da1d4485..6ccca57c5404686e2d85a0c1d513243d35264100 100644 (file)
@@ -33,6 +33,13 @@ func getForkRepository(ctx *middleware.Context) *models.Repository {
                }
                return nil
        }
+
+       // Cannot fork bare repo.
+       if forkRepo.IsBare {
+               ctx.Handle(404, "", nil)
+               return nil
+       }
+
        ctx.Data["repo_name"] = forkRepo.Name
        ctx.Data["desc"] = forkRepo.Description
        ctx.Data["IsPrivate"] = forkRepo.IsPrivate
index 74e04d09888ded9dba3ff78ee8de36e8f2418ac0..141c5514cf4f0500193273059827ffe38e422b47 100644 (file)
@@ -2,13 +2,15 @@
 <div class="ui container"><!-- start container -->
        <div class="ui vertically padded grid head"><!-- start grid -->
                <div class="column"><!-- start column -->
+                       {{if not .IsBare}}
                        <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>
                                        {{$.i18n.Tr "repo.fork"}}
                                </a>
                                <span class="active item num">{{.NumForks}}</span>
                        </div>
+                       {{end}}
 
                        <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}}">
index ecf9ed3a7fbf18e833372d4119d31a8eb2db2f50..0537cc02449e6d641777749a23445c921aac994d 100644 (file)
@@ -48,6 +48,7 @@
                     </button>
                 </a>
             </li>
+            {{if not .IsBare}}
             <li id="repo-header-fork">
                 <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">
@@ -57,6 +58,7 @@
                 </a>
             
             </li>
+            {{end}}
         </ul>
     </div>
 </div>