summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorUnknown <joe2010xtmf@163.com>2014-04-27 01:05:13 -0600
committerUnknown <joe2010xtmf@163.com>2014-04-27 01:05:13 -0600
commit62d23e91541550d0478c4884696e918a0e818b4f (patch)
tree335e18b41b15a419233e5117d1cbc43fa66f2b5c /models
parent59d0e73c3507296b31c8e741b44afc7bfe1eb695 (diff)
downloadgitea-62d23e91541550d0478c4884696e918a0e818b4f.tar.gz
gitea-62d23e91541550d0478c4884696e918a0e818b4f.zip
HTTP no follow and offline mode
Diffstat (limited to 'models')
-rw-r--r--models/repo.go16
-rw-r--r--models/update.go8
2 files changed, 9 insertions, 15 deletions
diff --git a/models/repo.go b/models/repo.go
index 2457174372..5f66bca86d 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -159,9 +159,7 @@ func MirrorUpdate() {
repoPath := filepath.Join(base.RepoRootPath, m.RepoName+".git")
_, stderr, err := com.ExecCmdDir(repoPath, "git", "remote", "update")
if err != nil {
- return err
- } else if strings.Contains(stderr, "fatal:") {
- return errors.New(stderr)
+ return errors.New("git remote update: " + stderr)
} else if err = git.UnpackRefs(repoPath); err != nil {
return err
}
@@ -177,9 +175,7 @@ func MirrorUpdate() {
func MirrorRepository(repoId int64, userName, repoName, repoPath, url string) error {
_, stderr, err := com.ExecCmd("git", "clone", "--mirror", url, repoPath)
if err != nil {
- return err
- } else if strings.Contains(stderr, "fatal:") {
- return errors.New(stderr)
+ return errors.New("git clone --mirror: " + stderr)
}
if _, err = orm.InsertOne(&Mirror{
@@ -219,23 +215,17 @@ func MigrateRepository(user *User, name, desc string, private, mirror bool, url
// Clone from local repository.
_, stderr, err := com.ExecCmd("git", "clone", repoPath, tmpDir)
if err != nil {
- return repo, err
- } else if strings.Contains(stderr, "fatal:") {
return repo, errors.New("git clone: " + stderr)
}
// Pull data from source.
_, stderr, err = com.ExecCmdDir(tmpDir, "git", "pull", url)
if err != nil {
- return repo, err
- } else if strings.Contains(stderr, "fatal:") {
return repo, errors.New("git pull: " + stderr)
}
// Push data to local repository.
if _, stderr, err = com.ExecCmdDir(tmpDir, "git", "push", "origin", "master"); err != nil {
- return repo, err
- } else if strings.Contains(stderr, "fatal:") {
return repo, errors.New("git push: " + stderr)
}
@@ -429,8 +419,6 @@ func initRepository(f string, user *User, repo *Repository, initReadme bool, rep
_, stderr, err := com.ExecCmd("git", "clone", repoPath, tmpDir)
if err != nil {
- return err
- } else if strings.Contains(stderr, "fatal:") {
return errors.New("git clone: " + stderr)
}
diff --git a/models/update.go b/models/update.go
index 2f59547b72..648c45f160 100644
--- a/models/update.go
+++ b/models/update.go
@@ -1,3 +1,7 @@
+// Copyright 2014 The Gogs Authors. All rights reserved.
+// Use of this source code is governed by a MIT-style
+// license that can be found in the LICENSE file.
+
package models
import (
@@ -5,9 +9,11 @@ import (
"os/exec"
"strings"
+ qlog "github.com/qiniu/log"
+
"github.com/gogits/git"
+
"github.com/gogits/gogs/modules/base"
- qlog "github.com/qiniu/log"
)
func Update(refName, oldCommitId, newCommitId, userName, repoName string, userId int64) {