mirror of
https://github.com/go-gitea/gitea.git
synced 2026-11-27 22:07:33 +08:00
`git.Push` took a raw local path and ran the command with `WithDir`. It now takes a `RepositoryFacade` and uses `WithRepo`, like the other repository commands, and `PushFromLocal` wraps its path with `gitrepo.RepositoryUnmanaged`. Unmanaged repositories resolve relative paths under the repository root, so a relative `APP_TEMP_PATH` is now made absolute at load. It already broke repository auto-init and would otherwise also break wiki and file edit pushes. No other behavior change. Assisted-by: Codet:claude Assisted-by: Claude Code:claude-opus-5-5 --------- Co-authored-by: silverwind <me@silverwind.io>
28 lines
910 B
Go
28 lines
910 B
Go
// Copyright 2025 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package git
|
|
|
|
import (
|
|
"context"
|
|
|
|
"gitea.dev/modules/git/gitrepo"
|
|
)
|
|
|
|
// PushToExternal pushes a managed repository to an external remote.
|
|
func PushToExternal(ctx context.Context, repo RepositoryFacade, opts PushOptions) error {
|
|
return Push(ctx, repo, opts)
|
|
}
|
|
|
|
// PushManaged pushes from one managed repository to another managed repository.
|
|
func PushManaged(ctx context.Context, fromRepo, toRepo RepositoryFacade, opts PushOptions) error {
|
|
opts.Remote = gitrepo.RepoLocalPath(toRepo)
|
|
return Push(ctx, fromRepo, opts)
|
|
}
|
|
|
|
// PushFromLocal pushes from a local path to a managed repository.
|
|
func PushFromLocal(ctx context.Context, fromLocalPath string, toRepo RepositoryFacade, opts PushOptions) error {
|
|
opts.Remote = gitrepo.RepoLocalPath(toRepo)
|
|
return Push(ctx, gitrepo.RepositoryUnmanaged(fromLocalPath), opts)
|
|
}
|