summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorUnknwon <joe2010xtmf@163.com>2014-09-02 07:11:39 -0400
committerUnknwon <joe2010xtmf@163.com>2014-09-02 07:11:39 -0400
commit830efc90da2895d65c3a2df32e7ef79cf2a8d556 (patch)
treecf8c205ef110ceed2f2834ad15d0023c92ebd1cc /models
parentc80f0232f1209a420cd4fa1d0c5b7c5e14ac4a6f (diff)
downloadgitea-830efc90da2895d65c3a2df32e7ef79cf2a8d556.tar.gz
gitea-830efc90da2895d65c3a2df32e7ef79cf2a8d556.zip
update docs and mirror bug fix
Diffstat (limited to 'models')
-rw-r--r--models/repo.go26
1 files changed, 3 insertions, 23 deletions
diff --git a/models/repo.go b/models/repo.go
index 105e8eecda..8f62fa17ae 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -277,7 +277,7 @@ func MirrorUpdate() {
// MigrateRepository migrates a existing repository from other project hosting.
func MigrateRepository(u *User, name, desc string, private, mirror bool, url string) (*Repository, error) {
- repo, err := CreateRepository(u, name, desc, "", "", private, true, false)
+ repo, err := CreateRepository(u, name, desc, "", "", private, mirror, false)
if err != nil {
return nil, err
}
@@ -305,6 +305,8 @@ func MigrateRepository(u *User, name, desc string, private, mirror bool, url str
}
repo.IsMirror = true
return repo, UpdateRepository(repo)
+ } else {
+ os.RemoveAll(repoPath)
}
// this command could for both migrate and mirror
@@ -314,28 +316,6 @@ func MigrateRepository(u *User, name, desc string, private, mirror bool, url str
if err != nil {
return repo, errors.New("git clone: " + stderr)
}
- // Clone from local repository.
- /*_, stderr, err := process.ExecTimeout(10*time.Minute,
- fmt.Sprintf("MigrateRepository(git clone): %s", repoPath),
- "git", "clone", repoPath, tmpDir)
- if err != nil {
- return repo, errors.New("git clone: " + stderr)
- }
-
- // Add remote and fetch data.
- if _, stderr, err = process.ExecDir(3*time.Minute,
- tmpDir, fmt.Sprintf("MigrateRepository(git pull): %s", repoPath),
- "git", "remote", "add", "-f", "--tags", "upstream", url); err != nil {
- return repo, errors.New("git remote: " + stderr)
- }
-
- // Push data to local repository.
- if _, stderr, err = process.ExecDir(3*time.Minute,
- tmpDir, fmt.Sprintf("MigrateRepository(git push): %s", repoPath),
- "git", "push", "--tags", "origin", "refs/remotes/upstream/*:refs/heads/*"); err != nil {
- return repo, errors.New("git push: " + stderr)
- }*/
-
return repo, UpdateRepository(repo)
}