mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-06-03 00:44:35 -04:00
HTTP no follow and offline mode
This commit is contained in:
parent
59d0e73c35
commit
62d23e9154
17 changed files with 55 additions and 75 deletions
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue