|
|
@ -19,6 +19,7 @@ import (
|
|
|
|
"time"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
|
|
"code.gitea.io/gitea/modules/proxy"
|
|
|
|
"code.gitea.io/gitea/modules/proxy"
|
|
|
|
|
|
|
|
"code.gitea.io/gitea/modules/util"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// GPGSettings represents the default GPG settings for this repository
|
|
|
|
// GPGSettings represents the default GPG settings for this repository
|
|
|
@ -154,6 +155,12 @@ func CloneWithArgs(ctx context.Context, from, to string, args []string, opts Clo
|
|
|
|
}
|
|
|
|
}
|
|
|
|
cmd.AddArguments("--", from, to)
|
|
|
|
cmd.AddArguments("--", from, to)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if strings.Contains(from, "://") && strings.Contains(from, "@") {
|
|
|
|
|
|
|
|
cmd.SetDescription(fmt.Sprintf("clone branch %s from %s to %s (shared: %t, mirror: %t, depth: %d)", opts.Branch, util.NewStringURLSanitizer(from, true).Replace(from), to, opts.Shared, opts.Mirror, opts.Depth))
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
cmd.SetDescription(fmt.Sprintf("clone branch %s from %s to %s (shared: %t, mirror: %t, depth: %d)", opts.Branch, from, to, opts.Shared, opts.Mirror, opts.Depth))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if opts.Timeout <= 0 {
|
|
|
|
if opts.Timeout <= 0 {
|
|
|
|
opts.Timeout = -1
|
|
|
|
opts.Timeout = -1
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -201,6 +208,11 @@ func Push(ctx context.Context, repoPath string, opts PushOptions) error {
|
|
|
|
if len(opts.Branch) > 0 {
|
|
|
|
if len(opts.Branch) > 0 {
|
|
|
|
cmd.AddArguments(opts.Branch)
|
|
|
|
cmd.AddArguments(opts.Branch)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if strings.Contains(opts.Remote, "://") && strings.Contains(opts.Remote, "@") {
|
|
|
|
|
|
|
|
cmd.SetDescription(fmt.Sprintf("push branch %s to %s (force: %t, mirror: %t)", opts.Branch, util.NewStringURLSanitizer(opts.Remote, true).Replace(opts.Remote), opts.Force, opts.Mirror))
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
cmd.SetDescription(fmt.Sprintf("push branch %s to %s (force: %t, mirror: %t)", opts.Branch, opts.Remote, opts.Force, opts.Mirror))
|
|
|
|
|
|
|
|
}
|
|
|
|
var outbuf, errbuf strings.Builder
|
|
|
|
var outbuf, errbuf strings.Builder
|
|
|
|
|
|
|
|
|
|
|
|
if opts.Timeout == 0 {
|
|
|
|
if opts.Timeout == 0 {
|
|
|
|