summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2016-02-15 14:26:21 -0500
committerUnknwon <u@gogs.io>2016-02-15 14:26:21 -0500
commitdc89c51f3efec39e120dd5b3878a8a9c922721ef (patch)
tree79b0eac741fe27d1ad681dbf4dd00ed147821c71 /models
parente9b9e6eb53d423bf7c8266a5ef9eeb463d8eb059 (diff)
parentbb595666ac3bdb5f16fa10663bd8890eb320fcb1 (diff)
downloadgitea-dc89c51f3efec39e120dd5b3878a8a9c922721ef.tar.gz
gitea-dc89c51f3efec39e120dd5b3878a8a9c922721ef.zip
Merge pull request #2624 from mhartkorn/convert-mirror-to-repo
Convert mirrors to regular repositories
Diffstat (limited to 'models')
-rw-r--r--models/repo.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/models/repo.go b/models/repo.go
index 4a8c8f0546..a08d3a4df1 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -655,7 +655,12 @@ func MigrateRepository(u *User, opts MigrateRepoOptions) (*Repository, error) {
return repo, UpdateRepository(repo, false)
}
- if err = createUpdateHook(repoPath); err != nil {
+ return CleanUpMigrateInfo(repo, repoPath)
+}
+
+// Finish migrating repository with things that don't need to be done for mirrors.
+func CleanUpMigrateInfo(repo *Repository, repoPath string) (*Repository, error) {
+ if err := createUpdateHook(repoPath); err != nil {
return repo, fmt.Errorf("createUpdateHook: %v", err)
}
@@ -1615,6 +1620,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) {