diff options
author | lunnyxiao <xiaolunwen@gmail.com> | 2014-09-02 11:59:39 +0800 |
---|---|---|
committer | lunnyxiao <xiaolunwen@gmail.com> | 2014-09-02 11:59:39 +0800 |
commit | c80f0232f1209a420cd4fa1d0c5b7c5e14ac4a6f (patch) | |
tree | 841ceb0f516c7a0338540773cb399de569f1b39c /models | |
parent | 85f375433dfb2114477b84350c67e80363747e21 (diff) | |
parent | 1240fef0ca252f03c8cd67ef84d6fd48cd3cb76d (diff) | |
download | gitea-c80f0232f1209a420cd4fa1d0c5b7c5e14ac4a6f.tar.gz gitea-c80f0232f1209a420cd4fa1d0c5b7c5e14ac4a6f.zip |
Merge branch 'master' into dev
Diffstat (limited to 'models')
-rw-r--r-- | models/repo.go | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/models/repo.go b/models/repo.go index 4703696678..105e8eecda 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, mirror, false) + repo, err := CreateRepository(u, name, desc, "", "", private, true, false) if err != nil { return nil, err } @@ -307,8 +307,15 @@ func MigrateRepository(u *User, name, desc string, private, mirror bool, url str return repo, UpdateRepository(repo) } - // Clone from local repository. + // this command could for both migrate and mirror _, stderr, err := process.ExecTimeout(10*time.Minute, + fmt.Sprintf("MigrateRepository: %s", repoPath), + "git", "clone", "--mirror", "--bare", url, repoPath) + 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 { @@ -327,7 +334,7 @@ func MigrateRepository(u *User, name, desc string, private, mirror bool, url str 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) } |