Skip to content

Commit 1f075eb

Browse files
committed
Merge remote-tracking branch 'upstream/release/v1.17' into codeberg-1.17
2 parents d96f802 + cedf4fe commit 1f075eb

File tree

3 files changed

+24
-14
lines changed

3 files changed

+24
-14
lines changed

modules/git/command.go

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,15 @@ func (c *Command) AddArguments(args ...string) *Command {
9595
return c
9696
}
9797

98-
// RunOpts represents parameters to run the command
98+
// RunOpts represents parameters to run the command. If UseContextTimeout is specified, then Timeout is ignored.
9999
type RunOpts struct {
100-
Env []string
101-
Timeout time.Duration
102-
Dir string
103-
Stdout, Stderr io.Writer
104-
Stdin io.Reader
105-
PipelineFunc func(context.Context, context.CancelFunc) error
100+
Env []string
101+
Timeout time.Duration
102+
UseContextTimeout bool
103+
Dir string
104+
Stdout, Stderr io.Writer
105+
Stdin io.Reader
106+
PipelineFunc func(context.Context, context.CancelFunc) error
106107
}
107108

108109
func commonBaseEnvs() []string {
@@ -171,7 +172,15 @@ func (c *Command) Run(opts *RunOpts) error {
171172
desc = fmt.Sprintf("%s %s [repo_path: %s]", c.name, strings.Join(args, " "), opts.Dir)
172173
}
173174

174-
ctx, cancel, finished := process.GetManager().AddContextTimeout(c.parentContext, opts.Timeout, desc)
175+
var ctx context.Context
176+
var cancel context.CancelFunc
177+
var finished context.CancelFunc
178+
179+
if opts.UseContextTimeout {
180+
ctx, cancel, finished = process.GetManager().AddContext(c.parentContext, desc)
181+
} else {
182+
ctx, cancel, finished = process.GetManager().AddContextTimeout(c.parentContext, opts.Timeout, desc)
183+
}
175184
defer finished()
176185

177186
cmd := exec.CommandContext(ctx, c.name, c.args...)

options/locale/locale_ru-RU.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1282,7 +1282,7 @@ issues.reopened_at=`переоткрыл(а) эту проблему <a id="%[1]
12821282
issues.commit_ref_at=`упомянул эту задачу в коммите <a id="%[1]s" href="#%[1]s">%[2]s</a>`
12831283
issues.ref_issue_from=`<a href="%[3]s">ссылка на эту проблему %[4]s</a> <a id="%[1]s" href="#%[1]s">%[2]s</a>`
12841284
issues.ref_pull_from=`<a href="%[3]s">ссылается на этот запрос на слияние %[4]s</a> <a id="%[1]s" href="#%[1]s">%[2]s</a>`
1285-
issues.ref_closing_from=`<a href="%[3]s">ссылается на запрос на слияние %[4], который закроет эту задачу</a> <a id="%[1]s" href="#%[1]s">%[2]s</a>`
1285+
issues.ref_closing_from=`<a href="%[3]s">ссылается на запрос на слияние %[4]s, который закроет эту задачу</a> <a id="%[1]s" href="#%[1]s">%[2]s</a>`
12861286
issues.ref_reopening_from=`<a href="%[3]s">ссылается на запрос на слияние %[4]s, который вновь откроет эту задачу</a> <a id="%[1]s" href="#%[1]s">%[2]s</a>`
12871287
issues.ref_closed_from=`<a href="%[3]s">закрыл этот запрос %[4]s</a> <a id="%[1]s" href="#%[1]s">%[2]s</a>`
12881288
issues.ref_reopened_from=`<a href="%[3]s">переоткрыл эту задачу %[4]s</a> <a id="%[1]s" href="#%[1]s">%[2]s</a>`

routers/web/repo/http.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -474,11 +474,12 @@ func serviceRPC(ctx gocontext.Context, h serviceHandler, service string) {
474474
cmd := git.NewCommand(h.r.Context(), service, "--stateless-rpc", h.dir)
475475
cmd.SetDescription(fmt.Sprintf("%s %s %s [repo_path: %s]", git.GitExecutable, service, "--stateless-rpc", h.dir))
476476
if err := cmd.Run(&git.RunOpts{
477-
Dir: h.dir,
478-
Env: append(os.Environ(), h.environ...),
479-
Stdout: h.w,
480-
Stdin: reqBody,
481-
Stderr: &stderr,
477+
Dir: h.dir,
478+
Env: append(os.Environ(), h.environ...),
479+
Stdout: h.w,
480+
Stdin: reqBody,
481+
Stderr: &stderr,
482+
UseContextTimeout: true,
482483
}); err != nil {
483484
if err.Error() != "signal: killed" {
484485
log.Error("Fail to serve RPC(%s) in %s: %v - %s", service, h.dir, err, stderr.String())

0 commit comments

Comments
 (0)