@@ -298,6 +298,8 @@ func Home(ctx *context.Context) {
298
298
return
299
299
}
300
300
301
+ // Check whether the repo is viewable: not in migration, and the code unit should be enabled
302
+ // Ideally the "feed" logic should be after this, but old code did so, so keep it as-is.
301
303
checkHomeCodeViewable (ctx )
302
304
if ctx .Written () {
303
305
return
@@ -309,14 +311,15 @@ func Home(ctx *context.Context) {
309
311
}
310
312
ctx .Data ["Title" ] = title
311
313
ctx .Data ["PageIsViewCode" ] = true
312
- ctx .Data ["RepositoryUploadEnabled" ] = setting .Repository .Upload .Enabled
314
+ ctx .Data ["RepositoryUploadEnabled" ] = setting .Repository .Upload .Enabled // show New File / Upload File buttons
313
315
314
316
if ctx .Repo .Commit == nil || ctx .Repo .Repository .IsEmpty || ctx .Repo .Repository .IsBroken () {
317
+ // emtpy or broken repositories need to be handled differently
315
318
handleRepoEmptyOrBroken (ctx )
316
319
return
317
320
}
318
321
319
- // Get current git entry user currently looking at.
322
+ // get the current git entry which doer user is currently looking at.
320
323
entry , err := ctx .Repo .Commit .GetTreeEntryByPath (ctx .Repo .TreePath )
321
324
if err != nil {
322
325
HandleGitError (ctx , "Repo.Commit.GetTreeEntryByPath" , err )
@@ -343,6 +346,7 @@ func Home(ctx *context.Context) {
343
346
ctx .Data ["TreeNames" ] = treeNames
344
347
ctx .Data ["BranchLink" ] = branchLink
345
348
349
+ // some UI components are only shown when the tree path is root
346
350
isTreePathRoot := ctx .Repo .TreePath == ""
347
351
348
352
prepareFuncs := []func (* context.Context ){
0 commit comments