From f9c0737a861050182aa1445146da003f1d8ec0ae Mon Sep 17 00:00:00 2001 From: zeripath Date: Sat, 12 Dec 2020 11:20:14 +0000 Subject: [PATCH] Enforce setting HEAD in wiki to master (#13950) The default branch in wikis must be master - therefore forcibly set the HEAD to master. Fix #13846 Signed-off-by: Andrew Thornton Co-authored-by: 6543 <6543@obermui.de> --- services/wiki/wiki.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/services/wiki/wiki.go b/services/wiki/wiki.go index 5f7d26a04..67ba1abd0 100644 --- a/services/wiki/wiki.go +++ b/services/wiki/wiki.go @@ -77,6 +77,8 @@ func InitWiki(repo *models.Repository) error { return fmt.Errorf("InitRepository: %v", err) } else if err = repo_module.CreateDelegateHooks(repo.WikiPath()); err != nil { return fmt.Errorf("createDelegateHooks: %v", err) + } else if _, err = git.NewCommand("symbolic-ref", "HEAD", git.BranchPrefix+"master").RunInDir(repo.WikiPath()); err != nil { + return fmt.Errorf("unable to set default wiki branch to master: %v", err) } return nil }