mirror of
https://github.com/go-gitea/gitea.git
synced 2026-01-24 04:15:35 +01:00
Fix bug
This commit is contained in:
parent
7228fb1498
commit
b4df643ad1
@ -186,6 +186,7 @@ func Clone(ctx context.Context, from, to string, opts CloneRepoOptions) error {
|
||||
// PushOptions options when push to remote
|
||||
type PushOptions struct {
|
||||
Remote string
|
||||
LocalBranch string
|
||||
Branch string
|
||||
Force bool
|
||||
ForceWithLease string
|
||||
@ -207,7 +208,13 @@ func Push(ctx context.Context, repoPath string, opts PushOptions) error {
|
||||
}
|
||||
remoteBranchArgs := []string{opts.Remote}
|
||||
if len(opts.Branch) > 0 {
|
||||
remoteBranchArgs = append(remoteBranchArgs, opts.Branch)
|
||||
var refspec string
|
||||
if opts.LocalBranch != "" {
|
||||
refspec = fmt.Sprintf("%s:%s", opts.LocalBranch, opts.Branch)
|
||||
} else {
|
||||
refspec = opts.Branch
|
||||
}
|
||||
remoteBranchArgs = append(remoteBranchArgs, refspec)
|
||||
}
|
||||
cmd.AddDashesAndList(remoteBranchArgs...)
|
||||
|
||||
|
||||
@ -74,6 +74,7 @@ func initRepoCommit(ctx context.Context, tmpPath string, repo *repo_model.Reposi
|
||||
}
|
||||
|
||||
if err := gitrepo.PushFromLocal(ctx, tmpPath, repo, git.PushOptions{
|
||||
LocalBranch: "HEAD",
|
||||
Branch: defaultBranch,
|
||||
Env: repo_module.InternalPushingEnvironment(u, repo),
|
||||
}); err != nil {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user