mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-09-08 08:33:27 +00:00
Moved UpdateRepository() to CleanUpMigrateInfo() and correctly delete mirror from database
This commit is contained in:
parent
15d37b7a95
commit
bb595666ac
2 changed files with 8 additions and 8 deletions
|
@ -654,12 +654,7 @@ func MigrateRepository(u *User, opts MigrateRepoOptions) (*Repository, error) {
|
||||||
return repo, UpdateRepository(repo, false)
|
return repo, UpdateRepository(repo, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
repo, err = CleanUpMigrateInfo(repo, repoPath)
|
return CleanUpMigrateInfo(repo, repoPath)
|
||||||
if err != nil {
|
|
||||||
return repo, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return repo, UpdateRepository(repo, false)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Finish migrating repository with things that don't need to be done for mirrors.
|
// Finish migrating repository with things that don't need to be done for mirrors.
|
||||||
|
@ -705,7 +700,7 @@ func CleanUpMigrateInfo(repo *Repository, repoPath string) (*Repository, error)
|
||||||
repo.DefaultBranch = headBranch.Name
|
repo.DefaultBranch = headBranch.Name
|
||||||
}
|
}
|
||||||
|
|
||||||
return repo, nil
|
return repo, UpdateRepository(repo, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
// initRepoCommit temporarily changes with work directory.
|
// initRepoCommit temporarily changes with work directory.
|
||||||
|
@ -1622,6 +1617,11 @@ func MirrorUpdate() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func DeleteMirrorByRepoID(repoId int64) error {
|
||||||
|
_, err := x.Delete(&Mirror{RepoID: repoId})
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
// GitFsck calls 'git fsck' to check repository health.
|
// GitFsck calls 'git fsck' to check repository health.
|
||||||
func GitFsck() {
|
func GitFsck() {
|
||||||
if taskStatusPool.IsRunning(_GIT_FSCK) {
|
if taskStatusPool.IsRunning(_GIT_FSCK) {
|
||||||
|
|
|
@ -165,7 +165,7 @@ func SettingsPost(ctx *middleware.Context, form auth.RepoSettingForm) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := models.UpdateRepository(repo, false); err != nil {
|
if err := models.DeleteMirrorByRepoID(ctx.Repo.Repository.ID); err != nil {
|
||||||
ctx.RenderWithErr(ctx.Tr("settings.convert.failed"), SETTINGS_OPTIONS, &form)
|
ctx.RenderWithErr(ctx.Tr("settings.convert.failed"), SETTINGS_OPTIONS, &form)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue