@@ -768,6 +768,7 @@ func checkCitationFile(ctx *context.Context, entry *git.TreeEntry) {
768
768
}
769
769
}
770
770
771
+
771
772
// Home render repository home page
772
773
func Home (ctx * context.Context ) {
773
774
if setting .Other .EnableFeed {
@@ -1006,6 +1007,8 @@ func renderHomeCode(ctx *context.Context) {
1006
1007
return
1007
1008
}
1008
1009
1010
+ checkOutdatedBranch (ctx )
1011
+
1009
1012
checkCitationFile (ctx , entry )
1010
1013
if ctx .Written () {
1011
1014
return
@@ -1072,6 +1075,31 @@ func renderHomeCode(ctx *context.Context) {
1072
1075
ctx .HTML (http .StatusOK , tplRepoHome )
1073
1076
}
1074
1077
1078
+ func checkOutdatedBranch (ctx * context.Context ) {
1079
+ // get the head commit of the branch since ctx.Repo.CommitID is not always the head commit of `ctx.Repo.BranchName`
1080
+ commit , err := ctx .Repo .GitRepo .GetBranchCommit (ctx .Repo .BranchName )
1081
+ if err != nil {
1082
+ log .Error ("GetBranchCommitID: %v" , err )
1083
+ // Don't return an error page, as it can be rechecked the next time the user opens the page.
1084
+ return
1085
+ }
1086
+
1087
+
1088
+ dbBranch , err := git_model .GetBranch (ctx , ctx .Repo .Repository .ID , ctx .Repo .BranchName )
1089
+ if err != nil {
1090
+ log .Error ("GetBranch: %v" , err )
1091
+ // Don't return an error page, as it can be rechecked the next time the user opens the page.
1092
+ return
1093
+ }
1094
+
1095
+ if commit .ID .String () != dbBranch .CommitID &&
1096
+ time .Since (commit .)
1097
+ {
1098
+
1099
+ }
1100
+ }
1101
+
1102
+
1075
1103
// RenderUserCards render a page show users according the input template
1076
1104
func RenderUserCards (ctx * context.Context , total int , getter func (opts db.ListOptions ) ([]* user_model.User , error ), tpl base.TplName ) {
1077
1105
page := ctx .FormInt ("page" )
@@ -1147,3 +1175,5 @@ func Forks(ctx *context.Context) {
1147
1175
1148
1176
ctx .HTML (http .StatusOK , tplForks )
1149
1177
}
1178
+
1179
+
0 commit comments