diff options
author | techknowlogick <techknowlogick@gitea.io> | 2020-06-17 19:32:06 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-17 19:32:06 -0400 |
commit | 7dc8db9ea8442f0c30a591c1627e85b27c6bde46 (patch) | |
tree | 02e94275a118c8e6a392d014d6ff006f544bc2b6 /modules | |
parent | ecad970a262a22879aae694277e263fc0e99607f (diff) | |
download | gitea-7dc8db9ea8442f0c30a591c1627e85b27c6bde46.tar.gz gitea-7dc8db9ea8442f0c30a591c1627e85b27c6bde46.zip |
Global default branch setting (#11918) (#11937)
* Global default branch setting (#11918)
* Global default branch setting
* add to app.ini example per @silverwind
* update per @lunny
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
* Update modules/setting/repository.go
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
Diffstat (limited to 'modules')
-rw-r--r-- | modules/repository/init.go | 3 | ||||
-rw-r--r-- | modules/setting/repository.go | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/modules/repository/init.go b/modules/repository/init.go index f468ca0435..8f3f2f0590 100644 --- a/modules/repository/init.go +++ b/modules/repository/init.go @@ -16,6 +16,7 @@ import ( "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/git" "code.gitea.io/gitea/modules/log" + "code.gitea.io/gitea/modules/setting" "github.com/mcuadros/go-version" "github.com/unknwon/com" @@ -147,7 +148,7 @@ func initRepoCommit(tmpPath string, repo *models.Repository, u *models.User, def } if len(defaultBranch) == 0 { - defaultBranch = "master" + defaultBranch = setting.Repository.DefaultBranch } if stdout, err := git.NewCommand("push", "origin", "master:"+defaultBranch). diff --git a/modules/setting/repository.go b/modules/setting/repository.go index 8af3eaaf46..164ba733e7 100644 --- a/modules/setting/repository.go +++ b/modules/setting/repository.go @@ -40,6 +40,7 @@ var ( DisabledRepoUnits []string DefaultRepoUnits []string PrefixArchiveFiles bool + DefaultBranch string // Repository editor settings Editor struct { @@ -201,6 +202,7 @@ func newRepository() { Repository.DisableHTTPGit = sec.Key("DISABLE_HTTP_GIT").MustBool() Repository.UseCompatSSHURI = sec.Key("USE_COMPAT_SSH_URI").MustBool() Repository.MaxCreationLimit = sec.Key("MAX_CREATION_LIMIT").MustInt(-1) + Repository.DefaultBranch = sec.Key("DEFAULT_BRANCH").MustString("master") RepoRootPath = sec.Key("ROOT").MustString(path.Join(homeDir, "gitea-repositories")) forcePathSeparator(RepoRootPath) if !filepath.IsAbs(RepoRootPath) { |