mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-25 08:54:17 -05:00
check master as default branch when migrate
This commit is contained in:
parent
1564b77cf5
commit
c6531c4882
1 changed files with 9 additions and 0 deletions
|
@ -380,6 +380,15 @@ func MigrateRepository(u *User, name, desc string, private, mirror bool, url str
|
||||||
return repo, fmt.Errorf("create update hook: %v", err)
|
return repo, fmt.Errorf("create update hook: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if repository has master branch, if so set it to default branch.
|
||||||
|
gitRepo, err := git.OpenRepository(repoPath)
|
||||||
|
if err != nil {
|
||||||
|
return repo, fmt.Errorf("open git repository: %v", err)
|
||||||
|
}
|
||||||
|
if gitRepo.IsBranchExist("master") {
|
||||||
|
repo.DefaultBranch = "master"
|
||||||
|
}
|
||||||
|
|
||||||
return repo, UpdateRepository(repo, false)
|
return repo, UpdateRepository(repo, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue