summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorMartin Hartkorn <github@hartkorn.net>2016-02-15 14:53:58 +0100
committerMartin Hartkorn <github@hartkorn.net>2016-02-15 14:59:24 +0100
commitbb595666ac3bdb5f16fa10663bd8890eb320fcb1 (patch)
treec3987eb0fc911cee7bf86ce9ef526c03ea8df5e0 /models
parent15d37b7a95829e7551d843925fb034bbc613b8f2 (diff)
downloadgitea-bb595666ac3bdb5f16fa10663bd8890eb320fcb1.tar.gz
gitea-bb595666ac3bdb5f16fa10663bd8890eb320fcb1.zip
Moved UpdateRepository() to CleanUpMigrateInfo() and correctly delete mirror from database
Diffstat (limited to 'models')
-rw-r--r--models/repo.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/models/repo.go b/models/repo.go
index dfd07f1982..be9e3fd753 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -654,12 +654,7 @@ func MigrateRepository(u *User, opts MigrateRepoOptions) (*Repository, error) {
return repo, UpdateRepository(repo, false)
}
- repo, err = CleanUpMigrateInfo(repo, repoPath)
- if err != nil {
- return repo, err
- }
-
- return repo, UpdateRepository(repo, false)
+ return CleanUpMigrateInfo(repo, repoPath)
}
// 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
}
- return repo, nil
+ return repo, UpdateRepository(repo, false)
}
// 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.
func GitFsck() {
if taskStatusPool.IsRunning(_GIT_FSCK) {