mirror of
https://github.com/go-gitea/gitea
synced 2025-07-03 09:07:19 +00:00
Fix bug conflict between SyncReleasesWithTags and InsertReleases (#7337)
* fix bug conflict between SyncReleasesWithTags and InsertReleases * fix tests * fix fmt
This commit is contained in:
@ -102,12 +102,13 @@ func TestRelease_MirrorDelete(t *testing.T) {
|
||||
repo := AssertExistsAndLoadBean(t, &Repository{ID: 1}).(*Repository)
|
||||
repoPath := RepoPath(user.Name, repo.Name)
|
||||
migrationOptions := MigrateRepoOptions{
|
||||
Name: "test_mirror",
|
||||
Description: "Test mirror",
|
||||
IsPrivate: false,
|
||||
IsMirror: true,
|
||||
RemoteAddr: repoPath,
|
||||
Wiki: true,
|
||||
Name: "test_mirror",
|
||||
Description: "Test mirror",
|
||||
IsPrivate: false,
|
||||
IsMirror: true,
|
||||
RemoteAddr: repoPath,
|
||||
Wiki: true,
|
||||
SyncReleasesWithTags: true,
|
||||
}
|
||||
mirror, err := MigrateRepository(user, user, migrationOptions)
|
||||
assert.NoError(t, err)
|
||||
|
@ -845,12 +845,13 @@ func (repo *Repository) CloneLink() (cl *CloneLink) {
|
||||
|
||||
// MigrateRepoOptions contains the repository migrate options
|
||||
type MigrateRepoOptions struct {
|
||||
Name string
|
||||
Description string
|
||||
IsPrivate bool
|
||||
IsMirror bool
|
||||
RemoteAddr string
|
||||
Wiki bool // include wiki repository
|
||||
Name string
|
||||
Description string
|
||||
IsPrivate bool
|
||||
IsMirror bool
|
||||
RemoteAddr string
|
||||
Wiki bool // include wiki repository
|
||||
SyncReleasesWithTags bool // sync releases from tags
|
||||
}
|
||||
|
||||
/*
|
||||
@ -942,7 +943,7 @@ func MigrateRepository(doer, u *User, opts MigrateRepoOptions) (*Repository, err
|
||||
return repo, fmt.Errorf("git.IsEmpty: %v", err)
|
||||
}
|
||||
|
||||
if !repo.IsEmpty {
|
||||
if opts.SyncReleasesWithTags && !repo.IsEmpty {
|
||||
// Try to get HEAD branch and set it as default branch.
|
||||
headBranch, err := gitRepo.GetHEADBranch()
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user