|
|
@ -102,18 +102,22 @@ func MigrateRepositoryGitData(doer, u *models.User, repo *models.Repository, opt |
|
|
|
return repo, fmt.Errorf("git.IsEmpty: %v", err) |
|
|
|
return repo, fmt.Errorf("git.IsEmpty: %v", err) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if !opts.Releases && !repo.IsEmpty { |
|
|
|
if !repo.IsEmpty { |
|
|
|
// Try to get HEAD branch and set it as default branch.
|
|
|
|
if len(repo.DefaultBranch) == 0 { |
|
|
|
headBranch, err := gitRepo.GetHEADBranch() |
|
|
|
// Try to get HEAD branch and set it as default branch.
|
|
|
|
if err != nil { |
|
|
|
headBranch, err := gitRepo.GetHEADBranch() |
|
|
|
return repo, fmt.Errorf("GetHEADBranch: %v", err) |
|
|
|
if err != nil { |
|
|
|
} |
|
|
|
return repo, fmt.Errorf("GetHEADBranch: %v", err) |
|
|
|
if headBranch != nil { |
|
|
|
} |
|
|
|
repo.DefaultBranch = headBranch.Name |
|
|
|
if headBranch != nil { |
|
|
|
|
|
|
|
repo.DefaultBranch = headBranch.Name |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if err = SyncReleasesWithTags(repo, gitRepo); err != nil { |
|
|
|
if !opts.Releases { |
|
|
|
log.Error("Failed to synchronize tags to releases for repository: %v", err) |
|
|
|
if err = SyncReleasesWithTags(repo, gitRepo); err != nil { |
|
|
|
|
|
|
|
log.Error("Failed to synchronize tags to releases for repository: %v", err) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|