Skip to content

Commit d906858

Browse files
authored
Use "main" as default branch name (#19354)
* Use "main" as default branch name * fix test code
1 parent 1dfa26e commit d906858

File tree

5 files changed

+5
-3
lines changed

5 files changed

+5
-3
lines changed

custom/conf/app.example.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,7 @@ PATH =
879879
;DISABLE_STARS = false
880880
;;
881881
;; The default branch name of new repositories
882-
;DEFAULT_BRANCH = master
882+
;DEFAULT_BRANCH = main
883883
;;
884884
;; Allow adoption of unadopted repositories
885885
;ALLOW_ADOPTION_OF_UNADOPTED_REPOSITORIES = false

docs/content/doc/advanced/config-cheat-sheet.en-us.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
7575
- `PREFIX_ARCHIVE_FILES`: **true**: Prefix archive files by placing them in a directory named after the repository.
7676
- `DISABLE_MIGRATIONS`: **false**: Disable migrating feature.
7777
- `DISABLE_STARS`: **false**: Disable stars feature.
78-
- `DEFAULT_BRANCH`: **master**: Default branch name of all repositories.
78+
- `DEFAULT_BRANCH`: **main**: Default branch name of all repositories.
7979
- `ALLOW_ADOPTION_OF_UNADOPTED_REPOSITORIES`: **false**: Allow non-admin users to adopt unadopted repositories
8080
- `ALLOW_DELETION_OF_UNADOPTED_REPOSITORIES`: **false**: Allow non-admin users to delete unadopted repositories
8181

integrations/integration_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ func initIntegrationTest() {
165165

166166
setting.SetCustomPathAndConf("", "", "")
167167
setting.LoadForTest()
168+
setting.Repository.DefaultBranch = "master" // many test code still assume that default branch is called "master"
168169
_ = util.RemoveAll(models.LocalCopyPath())
169170
git.CheckLFSVersion()
170171
setting.InitDBConfig()

models/unittest/testdb.go

+1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ func MainTest(m *testing.M, pathToGiteaRoot string, fixtureFiles ...string) {
6969
setting.SSH.Port = 3000
7070
setting.SSH.Domain = "try.gitea.io"
7171
setting.Database.UseSQLite3 = true
72+
setting.Repository.DefaultBranch = "master" // many test code still assume that default branch is called "master"
7273
repoRootPath, err := os.MkdirTemp(os.TempDir(), "repos")
7374
if err != nil {
7475
fatalTestError("TempDir: %v\n", err)

modules/setting/repository.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ var (
154154
PrefixArchiveFiles: true,
155155
DisableMigrations: false,
156156
DisableStars: false,
157-
DefaultBranch: "master",
157+
DefaultBranch: "main",
158158

159159
// Repository editor settings
160160
Editor: struct {

0 commit comments

Comments
 (0)