Skip to content

Commit 768e1ba

Browse files
committed
Merge remote-tracking branch 'upstream/main'
* upstream/main: Fix a bug returning 404 when display a single tag with no release (go-gitea#29466) Add a check for when the command is canceled by the program on Window… (go-gitea#29538) Fix incorrect redirection when creating a PR fails (go-gitea#29537) Fix incorrect subpath in links (go-gitea#29535) Fix issue link does not support quotes (go-gitea#29484) (go-gitea#29487)
2 parents ad3fe09 + cc27b50 commit 768e1ba

File tree

17 files changed

+51
-38
lines changed

17 files changed

+51
-38
lines changed

modules/git/command.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"io"
1313
"os"
1414
"os/exec"
15+
"runtime"
1516
"strings"
1617
"time"
1718

@@ -344,6 +345,17 @@ func (c *Command) Run(opts *RunOpts) error {
344345
log.Debug("slow git.Command.Run: %s (%s)", c, elapsed)
345346
}
346347

348+
// We need to check if the context is canceled by the program on Windows.
349+
// This is because Windows does not have signal checking when terminating the process.
350+
// It always returns exit code 1, unlike Linux, which has many exit codes for signals.
351+
if runtime.GOOS == "windows" &&
352+
err != nil &&
353+
err.Error() == "" &&
354+
cmd.ProcessState.ExitCode() == 1 &&
355+
ctx.Err() == context.Canceled {
356+
return ctx.Err()
357+
}
358+
347359
if err != nil && ctx.Err() != context.DeadlineExceeded {
348360
return err
349361
}

modules/references/references.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ var (
3131
// mentionPattern matches all mentions in the form of "@user" or "@org/team"
3232
mentionPattern = regexp.MustCompile(`(?:\s|^|\(|\[)(@[0-9a-zA-Z-_]+|@[0-9a-zA-Z-_]+\/?[0-9a-zA-Z-_]+|@[0-9a-zA-Z-_][0-9a-zA-Z-_.]+\/?[0-9a-zA-Z-_.]+[0-9a-zA-Z-_])(?:\s|[:,;.?!]\s|[:,;.?!]?$|\)|\])`)
3333
// issueNumericPattern matches string that references to a numeric issue, e.g. #1287
34-
issueNumericPattern = regexp.MustCompile(`(?:\s|^|\(|\[|\')([#!][0-9]+)(?:\s|$|\)|\]|[:;,.?!]\s|[:;,.?!]$)`)
34+
issueNumericPattern = regexp.MustCompile(`(?:\s|^|\(|\[|\'|\")([#!][0-9]+)(?:\s|$|\)|\]|\'|\"|[:;,.?!]\s|[:;,.?!]$)`)
3535
// issueAlphanumericPattern matches string that references to an alphanumeric issue, e.g. ABC-1234
36-
issueAlphanumericPattern = regexp.MustCompile(`(?:\s|^|\(|\[)([A-Z]{1,10}-[1-9][0-9]*)(?:\s|$|\)|\]|:|\.(\s|$))`)
36+
issueAlphanumericPattern = regexp.MustCompile(`(?:\s|^|\(|\[|\"|\')([A-Z]{1,10}-[1-9][0-9]*)(?:\s|$|\)|\]|:|\.(\s|$)|\"|\')`)
3737
// crossReferenceIssueNumericPattern matches string that references a numeric issue in a different repository
3838
// e.g. org/repo#12345
3939
crossReferenceIssueNumericPattern = regexp.MustCompile(`(?:\s|^|\(|\[)([0-9a-zA-Z-_\.]+/[0-9a-zA-Z-_\.]+[#!][0-9]+)(?:\s|$|\)|\]|[:;,.?!]\s|[:;,.?!]$)`)

modules/references/references_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,8 @@ func TestRegExp_issueNumericPattern(t *testing.T) {
429429
" #12",
430430
"#12:",
431431
"ref: #12: msg",
432+
"\"#1234\"",
433+
"'#1234'",
432434
}
433435
falseTestCases := []string{
434436
"# 1234",
@@ -459,6 +461,8 @@ func TestRegExp_issueAlphanumericPattern(t *testing.T) {
459461
"(ABC-123)",
460462
"[ABC-123]",
461463
"ABC-123:",
464+
"\"ABC-123\"",
465+
"'ABC-123'",
462466
}
463467
falseTestCases := []string{
464468
"RC-08",

options/locale/locale_en-US.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1792,9 +1792,9 @@ pulls.unrelated_histories = Merge Failed: The merge head and base do not share a
17921792
pulls.merge_out_of_date = Merge Failed: Whilst generating the merge, the base was updated. Hint: Try again.
17931793
pulls.head_out_of_date = Merge Failed: Whilst generating the merge, the head was updated. Hint: Try again.
17941794
pulls.has_merged = Failed: The pull request has been merged, you cannot merge again or change the target branch.
1795-
pulls.push_rejected = Merge Failed: The push was rejected. Review the Git Hooks for this repository.
1795+
pulls.push_rejected = Push Failed: The push was rejected. Review the Git Hooks for this repository.
17961796
pulls.push_rejected_summary = Full Rejection Message
1797-
pulls.push_rejected_no_message = Merge Failed: The push was rejected but there was no remote message.<br>Review the Git Hooks for this repository
1797+
pulls.push_rejected_no_message = Push Failed: The push was rejected but there was no remote message. Review the Git Hooks for this repository
17981798
pulls.open_unmerged_pull_exists = `You cannot perform a reopen operation because there is a pending pull request (#%d) with identical properties.`
17991799
pulls.status_checking = Some checks are pending
18001800
pulls.status_checks_success = All checks were successful

routers/web/repo/pull.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1501,7 +1501,7 @@ func CompareAndPullRequestPost(ctx *context.Context) {
15011501
return
15021502
}
15031503
ctx.Flash.Error(flashError)
1504-
ctx.JSONRedirect(pullIssue.Link()) // FIXME: it's unfriendly, and will make the content lost
1504+
ctx.JSONRedirect(ctx.Link + "?" + ctx.Req.URL.RawQuery) // FIXME: it's unfriendly, and will make the content lost
15051505
return
15061506
}
15071507
ctx.ServerError("NewPullRequest", err)

routers/web/repo/release.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,11 @@ func Releases(ctx *context.Context) {
185185
ctx.ServerError("getReleaseInfos", err)
186186
return
187187
}
188+
for _, rel := range releases {
189+
if rel.Release.IsTag && rel.Release.Title == "" {
190+
rel.Release.Title = rel.Release.TagName
191+
}
192+
}
188193

189194
ctx.Data["Releases"] = releases
190195

@@ -283,6 +288,7 @@ func SingleRelease(ctx *context.Context) {
283288
TagNames: []string{ctx.Params("*")},
284289
// only show draft releases for users who can write, read-only users shouldn't see draft releases.
285290
IncludeDrafts: writeAccess,
291+
IncludeTags: true,
286292
})
287293
if err != nil {
288294
ctx.ServerError("getReleaseInfos", err)
@@ -294,6 +300,9 @@ func SingleRelease(ctx *context.Context) {
294300
}
295301

296302
release := releases[0].Release
303+
if release.IsTag && release.Title == "" {
304+
release.Title = release.TagName
305+
}
297306

298307
ctx.Data["PageIsSingleTag"] = release.IsTag
299308
if release.IsTag {

templates/repo/diff/comments.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<div class="comment-header-right actions gt-df gt-ac">
3434
{{if .Invalidated}}
3535
{{$referenceUrl := printf "%s#%s" $.root.Issue.Link .HashTag}}
36-
<a href="{{AppSubUrl}}{{$referenceUrl}}" class="ui label basic small" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.review.outdated_description"}}">
36+
<a href="{{$referenceUrl}}" class="ui label basic small" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.review.outdated_description"}}">
3737
{{ctx.Locale.Tr "repo.issues.review.outdated"}}
3838
</a>
3939
{{end}}

templates/repo/diff/compare.tmpl

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,6 @@
1111
{{ctx.Locale.Tr "action.compare_commits_general"}}
1212
{{end}}
1313
</h2>
14-
{{if .Flash.WarningMsg}}
15-
{{/*
16-
There's already an importing of alert.tmpl in new_form.tmpl,
17-
but only the negative message will be displayed within forms for some reasons, see semantic.css:10659.
18-
To avoid repeated negative messages, the importing here if for .Flash.WarningMsg only.
19-
*/}}
20-
{{template "base/alert" .}}
21-
{{end}}
2214
{{$BaseCompareName := $.BaseName -}}
2315
{{- $HeadCompareName := $.HeadRepo.OwnerName -}}
2416
{{- if and (eq $.BaseName $.HeadRepo.OwnerName) (ne $.Repository.Name $.HeadRepo.Name) -}}

templates/repo/diff/conversation.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
We only handle the case $resolved=true and $invalid=true in this template because if the comment is not resolved it has the outdated label in the comments area (not the header above).
1515
The case $resolved=false and $invalid=true is handled in repo/diff/comments.tmpl
1616
-->
17-
<a href="{{AppSubUrl}}{{$referenceUrl}}" class="ui label basic small gt-ml-3" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.review.outdated_description"}}">
17+
<a href="{{$referenceUrl}}" class="ui label basic small gt-ml-3" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.review.outdated_description"}}">
1818
{{ctx.Locale.Tr "repo.issues.review.outdated"}}
1919
</a>
2020
{{end}}

templates/repo/issue/new.tmpl

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,6 @@
22
<div role="main" aria-label="{{.Title}}" class="page-content repository new issue">
33
{{template "repo/header" .}}
44
<div class="ui container">
5-
{{if .Flash.WarningMsg}}
6-
{{/*
7-
There's already an importing of alert.tmpl in new_form.tmpl,
8-
but only the negative message will be displayed within forms for some reasons, see semantic.css:10659.
9-
To avoid repeated negative messages, the importing here if for .Flash.WarningMsg only.
10-
*/}}
11-
{{template "base/alert" .}}
12-
{{end}}
135
{{template "repo/issue/new_form" .}}
146
</div>
157
</div>

0 commit comments

Comments
 (0)