summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2022-04-09 12:26:48 +0800
committerGitHub <noreply@github.com>2022-04-08 23:26:48 -0500
commitd906858847e0d345bc02f04b4037dfa80650889e (patch)
tree7632699bb22dd4f7e6b61113835e60ddf7aaf34d
parent1dfa26e00e8e1ce6f6125335871da1d402a63466 (diff)
downloadgitea-d906858847e0d345bc02f04b4037dfa80650889e.tar.gz
gitea-d906858847e0d345bc02f04b4037dfa80650889e.zip
Use "main" as default branch name (#19354)
* Use "main" as default branch name * fix test code
-rw-r--r--custom/conf/app.example.ini2
-rw-r--r--docs/content/doc/advanced/config-cheat-sheet.en-us.md2
-rw-r--r--integrations/integration_test.go1
-rw-r--r--models/unittest/testdb.go1
-rw-r--r--modules/setting/repository.go2
5 files changed, 5 insertions, 3 deletions
diff --git a/custom/conf/app.example.ini b/custom/conf/app.example.ini
index df49851311..4b5c2b1022 100644
--- a/custom/conf/app.example.ini
+++ b/custom/conf/app.example.ini
@@ -879,7 +879,7 @@ PATH =
;DISABLE_STARS = false
;;
;; The default branch name of new repositories
-;DEFAULT_BRANCH = master
+;DEFAULT_BRANCH = main
;;
;; Allow adoption of unadopted repositories
;ALLOW_ADOPTION_OF_UNADOPTED_REPOSITORIES = false
diff --git a/docs/content/doc/advanced/config-cheat-sheet.en-us.md b/docs/content/doc/advanced/config-cheat-sheet.en-us.md
index 967cd42381..9d70269bf2 100644
--- a/docs/content/doc/advanced/config-cheat-sheet.en-us.md
+++ b/docs/content/doc/advanced/config-cheat-sheet.en-us.md
@@ -75,7 +75,7 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
- `PREFIX_ARCHIVE_FILES`: **true**: Prefix archive files by placing them in a directory named after the repository.
- `DISABLE_MIGRATIONS`: **false**: Disable migrating feature.
- `DISABLE_STARS`: **false**: Disable stars feature.
-- `DEFAULT_BRANCH`: **master**: Default branch name of all repositories.
+- `DEFAULT_BRANCH`: **main**: Default branch name of all repositories.
- `ALLOW_ADOPTION_OF_UNADOPTED_REPOSITORIES`: **false**: Allow non-admin users to adopt unadopted repositories
- `ALLOW_DELETION_OF_UNADOPTED_REPOSITORIES`: **false**: Allow non-admin users to delete unadopted repositories
diff --git a/integrations/integration_test.go b/integrations/integration_test.go
index e7ceb33e96..8d2bfe9383 100644
--- a/integrations/integration_test.go
+++ b/integrations/integration_test.go
@@ -165,6 +165,7 @@ func initIntegrationTest() {
setting.SetCustomPathAndConf("", "", "")
setting.LoadForTest()
+ setting.Repository.DefaultBranch = "master" // many test code still assume that default branch is called "master"
_ = util.RemoveAll(models.LocalCopyPath())
git.CheckLFSVersion()
setting.InitDBConfig()
diff --git a/models/unittest/testdb.go b/models/unittest/testdb.go
index b6924d4706..4f1bd63f29 100644
--- a/models/unittest/testdb.go
+++ b/models/unittest/testdb.go
@@ -69,6 +69,7 @@ func MainTest(m *testing.M, pathToGiteaRoot string, fixtureFiles ...string) {
setting.SSH.Port = 3000
setting.SSH.Domain = "try.gitea.io"
setting.Database.UseSQLite3 = true
+ setting.Repository.DefaultBranch = "master" // many test code still assume that default branch is called "master"
repoRootPath, err := os.MkdirTemp(os.TempDir(), "repos")
if err != nil {
fatalTestError("TempDir: %v\n", err)
diff --git a/modules/setting/repository.go b/modules/setting/repository.go
index f4a2f4ad66..96b37f6980 100644
--- a/modules/setting/repository.go
+++ b/modules/setting/repository.go
@@ -154,7 +154,7 @@ var (
PrefixArchiveFiles: true,
DisableMigrations: false,
DisableStars: false,
- DefaultBranch: "master",
+ DefaultBranch: "main",
// Repository editor settings
Editor: struct {