|
|
|
|
|
|
|
|
repo.DefaultBranch = "master" |
|
|
repo.DefaultBranch = "master" |
|
|
if len(opts.DefaultBranch) > 0 { |
|
|
if len(opts.DefaultBranch) > 0 { |
|
|
repo.DefaultBranch = opts.DefaultBranch |
|
|
repo.DefaultBranch = opts.DefaultBranch |
|
|
|
|
|
gitRepo, err := git.OpenRepository(repo.RepoPath()) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return fmt.Errorf("openRepository: %v", err) |
|
|
|
|
|
} |
|
|
|
|
|
if err = gitRepo.SetDefaultBranch(repo.DefaultBranch); err != nil { |
|
|
|
|
|
return fmt.Errorf("setDefaultBranch: %v", err) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if err = models.UpdateRepositoryCtx(ctx, repo, false); err != nil { |
|
|
if err = models.UpdateRepositoryCtx(ctx, repo, false); err != nil { |