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 <art27@cantab.net>

Co-authored-by: 6543 <6543@obermui.de>
tokarchuk/v1.17
zeripath 4 years ago committed by GitHub
parent 1837e647eb
commit f9c0737a86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      services/wiki/wiki.go

@ -77,6 +77,8 @@ func InitWiki(repo *models.Repository) error {
return fmt.Errorf("InitRepository: %v", err) return fmt.Errorf("InitRepository: %v", err)
} else if err = repo_module.CreateDelegateHooks(repo.WikiPath()); err != nil { } else if err = repo_module.CreateDelegateHooks(repo.WikiPath()); err != nil {
return fmt.Errorf("createDelegateHooks: %v", err) 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 return nil
} }

Loading…
Cancel
Save