feat: vendor gitea 1.16.2
This commit is contained in:
@@ -23,6 +23,7 @@ import (
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
"code.gitea.io/gitea/services/migrations"
|
||||
repo_service "code.gitea.io/gitea/services/repository"
|
||||
)
|
||||
|
||||
@@ -124,14 +125,12 @@ func runPushSync(ctx context.Context, m *repo_model.PushMirror) error {
|
||||
|
||||
performPush := func(repo *repo_model.Repository, isWiki bool) error {
|
||||
var storageRepo gitrepo.Repository = repo
|
||||
path := repo.RepoPath()
|
||||
if isWiki {
|
||||
storageRepo = repo.WikiStorageRepo()
|
||||
path = repo.WikiPath()
|
||||
}
|
||||
remoteURL, err := gitrepo.GitRemoteGetURL(ctx, storageRepo, m.RemoteName)
|
||||
if err != nil {
|
||||
log.Error("GetRemoteURL(%s) Error %v", path, err)
|
||||
log.Error("GetRemoteURL(%s) Error %v", storageRepo.RelativePath(), err)
|
||||
return errors.New("Unexpected error")
|
||||
}
|
||||
|
||||
@@ -146,23 +145,23 @@ func runPushSync(ctx context.Context, m *repo_model.PushMirror) error {
|
||||
defer gitRepo.Close()
|
||||
|
||||
endpoint := lfs.DetermineEndpoint(remoteURL.String(), "")
|
||||
lfsClient := lfs.NewClient(endpoint, nil)
|
||||
lfsClient := lfs.NewClient(endpoint, migrations.NewMigrationHTTPTransport())
|
||||
if err := pushAllLFSObjects(ctx, gitRepo, lfsClient); err != nil {
|
||||
return util.SanitizeErrorCredentialURLs(err)
|
||||
}
|
||||
}
|
||||
|
||||
log.Trace("Pushing %s mirror[%d] remote %s", path, m.ID, m.RemoteName)
|
||||
log.Trace("Pushing %s mirror[%d] remote %s", storageRepo.RelativePath(), m.ID, m.RemoteName)
|
||||
|
||||
envs := proxy.EnvWithProxy(remoteURL.URL)
|
||||
if err := git.Push(ctx, path, git.PushOptions{
|
||||
if err := gitrepo.PushToExternal(ctx, storageRepo, git.PushOptions{
|
||||
Remote: m.RemoteName,
|
||||
Force: true,
|
||||
Mirror: true,
|
||||
Timeout: timeout,
|
||||
Env: envs,
|
||||
}); err != nil {
|
||||
log.Error("Error pushing %s mirror[%d] remote %s: %v", path, m.ID, m.RemoteName, err)
|
||||
log.Error("Error pushing %s mirror[%d] remote %s: %v", storageRepo.RelativePath(), m.ID, m.RemoteName, err)
|
||||
|
||||
return util.SanitizeErrorCredentialURLs(err)
|
||||
}
|
||||
@@ -194,7 +193,9 @@ func pushAllLFSObjects(ctx context.Context, gitRepo *git.Repository, lfsClient l
|
||||
|
||||
pointerChan := make(chan lfs.PointerBlob)
|
||||
errChan := make(chan error, 1)
|
||||
go lfs.SearchPointerBlobs(ctx, gitRepo, pointerChan, errChan)
|
||||
go func() {
|
||||
errChan <- lfs.SearchPointerBlobs(ctx, gitRepo, pointerChan)
|
||||
}()
|
||||
|
||||
uploadObjects := func(pointers []lfs.Pointer) error {
|
||||
err := lfsClient.Upload(ctx, pointers, func(p lfs.Pointer, objectError error) (io.ReadCloser, error) {
|
||||
@@ -244,13 +245,12 @@ func pushAllLFSObjects(ctx context.Context, gitRepo *git.Repository, lfsClient l
|
||||
}
|
||||
}
|
||||
|
||||
err, has := <-errChan
|
||||
if has {
|
||||
err := <-errChan
|
||||
if err != nil {
|
||||
log.Error("Error enumerating LFS objects for repository: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
return err
|
||||
}
|
||||
|
||||
func syncPushMirrorWithSyncOnCommit(ctx context.Context, repoID int64) {
|
||||
|
||||
Reference in New Issue
Block a user