From 05ee88e576ba922460924d2cb9df4a9d98767664 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sat, 12 Dec 2020 17:21:26 +0000 Subject: [PATCH] Enforce setting HEAD in wiki to master (#13950) (#13961) 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> Co-authored-by: zeripath --- services/wiki/wiki.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/services/wiki/wiki.go b/services/wiki/wiki.go index 5f7d26a045d..67ba1abd0f5 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 }