diff --git a/.drone.yml b/.drone.yml index 928e75d1ac75e..8f06877fbaf88 100644 --- a/.drone.yml +++ b/.drone.yml @@ -19,7 +19,7 @@ volumes: steps: - name: deps-frontend - image: node:16 + image: node:18 pull: always commands: - make deps-frontend @@ -34,7 +34,7 @@ steps: path: /go - name: lint-frontend - image: node:16 + image: node:18 commands: - make lint-frontend depends_on: [deps-frontend] @@ -82,7 +82,7 @@ steps: path: /go - name: checks-frontend - image: node:16 + image: node:18 commands: - make checks-frontend depends_on: [deps-frontend] @@ -97,13 +97,13 @@ steps: path: /go - name: test-frontend - image: node:16 + image: node:18 commands: - make test-frontend depends_on: [lint-frontend] - name: build-frontend - image: node:16 + image: node:18 commands: - make frontend depends_on: [test-frontend] @@ -634,7 +634,7 @@ steps: - git fetch --tags --force - name: deps-frontend - image: node:16 + image: node:18 pull: always commands: - make deps-frontend @@ -652,7 +652,7 @@ steps: image: techknowlogick/xgo:go-1.18.x pull: always commands: - - curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs + - curl -sL https://deb.nodesource.com/setup_18.x | bash - && apt-get install -y nodejs - export PATH=$PATH:$GOPATH/bin - make release environment: @@ -753,7 +753,7 @@ steps: - git fetch --tags --force - name: deps-frontend - image: node:16 + image: node:18 pull: always commands: - make deps-frontend @@ -771,7 +771,7 @@ steps: image: techknowlogick/xgo:go-1.18.x pull: always commands: - - curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs + - curl -sL https://deb.nodesource.com/setup_18.x | bash - && apt-get install -y nodejs - export PATH=$PATH:$GOPATH/bin - make release environment: diff --git a/CHANGELOG.md b/CHANGELOG.md index 406433e954330..454853fe2918c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,9 +4,15 @@ This changelog goes through all the changes that have been made in each release without substantial changes to our git log; to see the highlights of what has been added to each release, please refer to the [blog](https://blog.gitea.io). -## [1.16.9](https://github.com/go-gitea/gitea/releases/tag/v1.16.9) - 2022-06-21 +## [1.16.9](https://github.com/go-gitea/gitea/releases/tag/v1.16.9) - 2022-07-12 +* SECURITY + * Add write check for creating Commit status (#20332) (#20334) + * Check for permission when fetching user controlled issues (#20133) (#20196) * BUGFIXES + * Hide notify mail setting ui if not enabled (#20138) (#20337) + * Add write check for creating Commit status (#20332) (#20334) + * Only show Followers that current user can access (#20220) (#20253) * Release page show all tags in compare dropdown (#20070) (#20071) * Fix permission check for delete tag (#19985) (#20001) * Only log non ErrNotExist errors in git.GetNote (#19884) (#19905) diff --git a/Dockerfile.rootless b/Dockerfile.rootless index e576570e5ecbc..c597fb29c856d 100644 --- a/Dockerfile.rootless +++ b/Dockerfile.rootless @@ -62,7 +62,7 @@ ENV GITEA_CUSTOM /var/lib/gitea/custom ENV GITEA_TEMP /tmp/gitea ENV TMPDIR /tmp/gitea -#TODO add to docs the ability to define the ini to load (usefull to test and revert a config) +#TODO add to docs the ability to define the ini to load (useful to test and revert a config) ENV GITEA_APP_INI /etc/gitea/app.ini ENV HOME "/var/lib/gitea/git" VOLUME ["/var/lib/gitea", "/etc/gitea"] diff --git a/Makefile b/Makefile index 866b8c892e34e..41d39b4c32328 100644 --- a/Makefile +++ b/Makefile @@ -771,7 +771,7 @@ generate-manpage: @mkdir -p man/man1/ man/man5 @./gitea docs --man > man/man1/gitea.1 @gzip -9 man/man1/gitea.1 && echo man/man1/gitea.1.gz created - @#TODO A smal script witch format config-cheat-sheet.en-us.md nicely to suit as config man page + @#TODO A small script that formats config-cheat-sheet.en-us.md nicely for use as a config man page .PHONY: pr\#% pr\#%: clean-all diff --git a/README.md b/README.md index 172e16cf56328..6c5952894aca9 100644 --- a/README.md +++ b/README.md @@ -102,7 +102,7 @@ NOTES: Translations are done through Crowdin. If you want to translate to a new language ask one of the managers in the Crowdin project to add a new language there. -You can also just create an issue for adding a language or ask on discord on the #translation channel. If you need context or find some translation issues, you can leave a comment on the string or ask on Discord. For general translation questions there is a section in the docs. Currently a bit empty but we hope fo fill it as questions pop up. +You can also just create an issue for adding a language or ask on discord on the #translation channel. If you need context or find some translation issues, you can leave a comment on the string or ask on Discord. For general translation questions there is a section in the docs. Currently a bit empty but we hope to fill it as questions pop up. https://docs.gitea.io/en-us/translation-guidelines/ diff --git a/cmd/manager.go b/cmd/manager.go index 03fe23aa9e3f0..8fbfd1093cbca 100644 --- a/cmd/manager.go +++ b/cmd/manager.go @@ -82,7 +82,7 @@ var ( }, cli.BoolFlag{ Name: "no-system", - Usage: "Do not show system proceses", + Usage: "Do not show system processes", }, cli.BoolFlag{ Name: "stacktraces", diff --git a/custom/conf/app.example.ini b/custom/conf/app.example.ini index fb43ea95a1d44..08708948940fa 100644 --- a/custom/conf/app.example.ini +++ b/custom/conf/app.example.ini @@ -2232,6 +2232,7 @@ ROUTER = console ;BLOCKED_DOMAINS = ;; ;; Allow private addresses defined by RFC 1918, RFC 1122, RFC 4632 and RFC 4291 (false by default) +;; If a domain is allowed by ALLOWED_DOMAINS, this option will be ignored. ;ALLOW_LOCALNETWORKS = false ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/docs/content/doc/advanced/config-cheat-sheet.en-us.md b/docs/content/doc/advanced/config-cheat-sheet.en-us.md index 84e3c6ae33df3..a0e6fb8f13b1b 100644 --- a/docs/content/doc/advanced/config-cheat-sheet.en-us.md +++ b/docs/content/doc/advanced/config-cheat-sheet.en-us.md @@ -1083,7 +1083,7 @@ Task queue configuration has been moved to `queue.task`. However, the below conf - `RETRY_BACKOFF`: **3**: Backoff time per http/https request retry (seconds) - `ALLOWED_DOMAINS`: **\**: Domains allowlist for migrating repositories, default is blank. It means everything will be allowed. Multiple domains could be separated by commas. Wildcard is supported: `github.com, *.github.com`. - `BLOCKED_DOMAINS`: **\**: Domains blocklist for migrating repositories, default is blank. Multiple domains could be separated by commas. When `ALLOWED_DOMAINS` is not blank, this option has a higher priority to deny domains. Wildcard is supported. -- `ALLOW_LOCALNETWORKS`: **false**: Allow private addresses defined by RFC 1918, RFC 1122, RFC 4632 and RFC 4291 +- `ALLOW_LOCALNETWORKS`: **false**: Allow private addresses defined by RFC 1918, RFC 1122, RFC 4632 and RFC 4291. If a domain is allowed by `ALLOWED_DOMAINS`, this option will be ignored. - `SKIP_TLS_VERIFY`: **false**: Allow skip tls verify ## Federation (`federation`) diff --git a/docs/content/doc/advanced/config-cheat-sheet.zh-cn.md b/docs/content/doc/advanced/config-cheat-sheet.zh-cn.md index ef1504bc94fcb..33c693083d02f 100644 --- a/docs/content/doc/advanced/config-cheat-sheet.zh-cn.md +++ b/docs/content/doc/advanced/config-cheat-sheet.zh-cn.md @@ -346,7 +346,7 @@ ALLOW_DATA_URI_IMAGES = true - `ALLOW_DATA_URI_IMAGES`: **false** 允许 data uri 图片 (``)。 多个净化规则可以被同时定义,只要section名称最后一位不重复即可。如: `[markup.sanitizer.TeX-2]`。 -为了针对一种渲染类型进行一个特殊的净化策略,必须使用形如 `[markup.sanitizer.asciidoc.rule-1]` 的方式来命名 seciton。 +为了针对一种渲染类型进行一个特殊的净化策略,必须使用形如 `[markup.sanitizer.asciidoc.rule-1]` 的方式来命名 section。 如果此规则没有匹配到任何渲染类型,它将会被应用到所有的渲染类型。 ## Time (`time`) diff --git a/docs/content/doc/advanced/customizing-gitea.en-us.md b/docs/content/doc/advanced/customizing-gitea.en-us.md index 3381c66d844ea..8f23fc33462c1 100644 --- a/docs/content/doc/advanced/customizing-gitea.en-us.md +++ b/docs/content/doc/advanced/customizing-gitea.en-us.md @@ -202,7 +202,7 @@ You can display STL file directly in Gitea by adding: to the file `templates/custom/footer.tmpl` -You also need to download the content of the library [Madeleine.js](https://jinjunho.github.io/Madeleine.js/) and place it under `$GITEA_CUSTOM/public/` folder. +You also need to download the content of the library [Madeleine.js](https://github.com/beige90/Madeleine.js) and place it under `$GITEA_CUSTOM/public/` folder. You should end-up with a folder structure similar to: diff --git a/docs/content/doc/packages/nuget.en-us.md b/docs/content/doc/packages/nuget.en-us.md index 0b92d85a3d4e9..421faf9ee6503 100644 --- a/docs/content/doc/packages/nuget.en-us.md +++ b/docs/content/doc/packages/nuget.en-us.md @@ -23,7 +23,7 @@ Publish [NuGet](https://www.nuget.org/) packages for your user or organization. ## Requirements To work with the NuGet package registry, you can use command-line interface tools as well as NuGet features in various IDEs like Visual Studio. -More informations about NuGet clients can be found in [the official documentation](https://docs.microsoft.com/en-us/nuget/install-nuget-client-tools). +More information about NuGet clients can be found in [the official documentation](https://docs.microsoft.com/en-us/nuget/install-nuget-client-tools). The following examples use the `dotnet nuget` tool. ## Configuring the package registry diff --git a/integrations/dump_restore_test.go b/integrations/dump_restore_test.go index 3723334ea155d..ef869c4ddabcd 100644 --- a/integrations/dump_restore_test.go +++ b/integrations/dump_restore_test.go @@ -201,7 +201,7 @@ func (c *compareDump) assertEquals(repoBefore, repoAfter *repo_model.Repository) "Assignees": {ignore: true}, // not implemented yet "Head": {nested: comparePullRequestBranch}, "Base": {nested: comparePullRequestBranch}, - "Labels": {ignore: true}, // because org labels are not handled propery + "Labels": {ignore: true}, // because org labels are not handled properly }).([]*base.PullRequest) assert.True(c.t, ok) assert.GreaterOrEqual(c.t, len(prs), 1) diff --git a/integrations/pull_status_test.go b/integrations/pull_status_test.go index a5247f56ec5f3..33a27cd81275a 100644 --- a/integrations/pull_status_test.go +++ b/integrations/pull_status_test.go @@ -105,7 +105,11 @@ func doAPICreateCommitStatus(ctx APITestContext, commitID string, status api.Com } } -func TestPullCreate_EmptyChangesWithCommits(t *testing.T) { +func TestPullCreate_EmptyChangesWithDifferentCommits(t *testing.T) { + // Merge must continue if commits SHA are different, even if content is same + // Reason: gitflow and merging master back into develop, where is high possiblity, there are no changes + // but just commit saying "Merge branch". And this meta commit can be also tagged, + // so we need to have this meta commit also in develop branch. onGiteaRun(t, func(t *testing.T, u *url.URL) { session := loginUser(t, "user1") testRepoFork(t, session, "user2", "repo1", "user1", "repo1") @@ -126,6 +130,28 @@ func TestPullCreate_EmptyChangesWithCommits(t *testing.T) { doc := NewHTMLParser(t, resp.Body) text := strings.TrimSpace(doc.doc.Find(".merge-section").Text()) - assert.Contains(t, text, "This branch is equal with the target branch.") + assert.Contains(t, text, "This pull request can be merged automatically.") + }) +} + +func TestPullCreate_EmptyChangesWithSameCommits(t *testing.T) { + onGiteaRun(t, func(t *testing.T, u *url.URL) { + session := loginUser(t, "user1") + testRepoFork(t, session, "user2", "repo1", "user1", "repo1") + testCreateBranch(t, session, "user1", "repo1", "branch/master", "status1", http.StatusSeeOther) + url := path.Join("user1", "repo1", "compare", "master...status1") + req := NewRequestWithValues(t, "POST", url, + map[string]string{ + "_csrf": GetCSRF(t, session, url), + "title": "pull request from status1", + }, + ) + session.MakeRequest(t, req, http.StatusSeeOther) + req = NewRequest(t, "GET", "/user1/repo1/pulls/1") + resp := session.MakeRequest(t, req, http.StatusOK) + doc := NewHTMLParser(t, resp.Body) + + text := strings.TrimSpace(doc.doc.Find(".merge-section").Text()) + assert.Contains(t, text, "This branch is already included in the target branch. There is nothing to merge.") }) } diff --git a/models/db/context.go b/models/db/context.go index 783033c0e03a6..4fd35200cf71c 100644 --- a/models/db/context.go +++ b/models/db/context.go @@ -100,7 +100,7 @@ func TxContext() (*Context, Committer, error) { } // WithTx represents executing database operations on a transaction -// you can optionally change the context to a parrent one +// you can optionally change the context to a parent one func WithTx(f func(ctx context.Context) error, stdCtx ...context.Context) error { parentCtx := DefaultContext if len(stdCtx) != 0 && stdCtx[0] != nil { diff --git a/models/issues/label.go b/models/issues/label.go index 9ad488252ab7f..667a608687436 100644 --- a/models/issues/label.go +++ b/models/issues/label.go @@ -17,6 +17,7 @@ import ( "code.gitea.io/gitea/models/db" user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/timeutil" + "code.gitea.io/gitea/modules/util" "xorm.io/builder" ) @@ -107,6 +108,7 @@ func (label *Label) CalOpenOrgIssues(repoID, labelID int64) { counts, _ := CountIssuesByRepo(&IssuesOptions{ RepoID: repoID, LabelIDs: []int64{labelID}, + IsClosed: util.OptionalBoolFalse, }) for _, count := range counts { diff --git a/models/issues/pull.go b/models/issues/pull.go index 52b9596889066..f96b03445e91f 100644 --- a/models/issues/pull.go +++ b/models/issues/pull.go @@ -122,6 +122,7 @@ const ( PullRequestStatusManuallyMerged PullRequestStatusError PullRequestStatusEmpty + PullRequestStatusAncestor ) // PullRequestFlow the flow of pull request @@ -423,6 +424,11 @@ func (pr *PullRequest) IsEmpty() bool { return pr.Status == PullRequestStatusEmpty } +// IsAncestor returns true if the Head Commit of this PR is an ancestor of the Base Commit +func (pr *PullRequest) IsAncestor() bool { + return pr.Status == PullRequestStatusAncestor +} + // SetMerged sets a pull request to merged and closes the corresponding issue func (pr *PullRequest) SetMerged(ctx context.Context) (bool, error) { if pr.HasMerged { diff --git a/models/issues/pull_list.go b/models/issues/pull_list.go index 9ca536909eb73..8eeffa2c0d16b 100644 --- a/models/issues/pull_list.go +++ b/models/issues/pull_list.go @@ -62,7 +62,7 @@ func GetUnmergedPullRequestsByHeadInfo(repoID int64, branch string) ([]*PullRequ Find(&prs) } -// CanMaintainerWriteToBranch check whether user is a matainer and could write to the branch +// CanMaintainerWriteToBranch check whether user is a maintainer and could write to the branch func CanMaintainerWriteToBranch(p access_model.Permission, branch string, user *user_model.User) bool { if p.CanWrite(unit.TypeCode) { return true diff --git a/models/organization/team_repo.go b/models/organization/team_repo.go index 717d754c40b7f..fb3f267f817af 100644 --- a/models/organization/team_repo.go +++ b/models/organization/team_repo.go @@ -55,7 +55,7 @@ func GetTeamRepositories(ctx context.Context, opts *SearchTeamRepoOptions) ([]*r Find(&repos) } -// AddTeamRepo addes a repo for an organization's team +// AddTeamRepo adds a repo for an organization's team func AddTeamRepo(ctx context.Context, orgID, teamID, repoID int64) error { _, err := db.GetEngine(ctx).Insert(&TeamRepo{ OrgID: orgID, diff --git a/modules/charset/charset.go b/modules/charset/charset.go index 89bbf1f8c93a8..a1210d2f05dc5 100644 --- a/modules/charset/charset.go +++ b/modules/charset/charset.go @@ -23,7 +23,7 @@ import ( // UTF8BOM is the utf-8 byte-order marker var UTF8BOM = []byte{'\xef', '\xbb', '\xbf'} -// ToUTF8WithFallbackReader detects the encoding of content and coverts to UTF-8 reader if possible +// ToUTF8WithFallbackReader detects the encoding of content and converts to UTF-8 reader if possible func ToUTF8WithFallbackReader(rd io.Reader) io.Reader { buf := make([]byte, 2048) n, err := util.ReadAtMost(rd, buf) @@ -76,7 +76,7 @@ func ToUTF8WithErr(content []byte) (string, error) { return string(result), err } -// ToUTF8WithFallback detects the encoding of content and coverts to UTF-8 if possible +// ToUTF8WithFallback detects the encoding of content and converts to UTF-8 if possible func ToUTF8WithFallback(content []byte) []byte { bs, _ := io.ReadAll(ToUTF8WithFallbackReader(bytes.NewReader(content))) return bs @@ -191,7 +191,7 @@ func DetectEncoding(content []byte) (string, error) { break } - // Otherwise check if this results is earlier in the DetectedCharsetOrder than our current top guesss + // Otherwise check if this results is earlier in the DetectedCharsetOrder than our current top guess resultPriority, resultHas := setting.Repository.DetectedCharsetScore[strings.ToLower(strings.TrimSpace(result.Charset))] if resultHas && (!has || resultPriority < priority) { topResult = result diff --git a/modules/doctor/breaking.go b/modules/doctor/breaking.go index 3e01d97d7c731..391c8e76c5907 100644 --- a/modules/doctor/breaking.go +++ b/modules/doctor/breaking.go @@ -32,8 +32,8 @@ func iterateUserAccounts(ctx context.Context, each func(*user.User) error) error // Ref: https://github.com/go-gitea/gitea/pull/19085 & https://github.com/go-gitea/gitea/pull/17688 func checkUserEmail(ctx context.Context, logger log.Logger, _ bool) error { // We could use quirky SQL to get all users that start without a [a-zA-Z0-9], but that would mean - // DB provider-specific SQL and only works _now_. So instead we iterate trough all user accounts and - // use the user.ValidateEmail function to be future-proof. + // DB provider-specific SQL and only works _now_. So instead we iterate through all user accounts + // and use the user.ValidateEmail function to be future-proof. var invalidUserCount int64 if err := iterateUserAccounts(ctx, func(u *user.User) error { // Only check for users, skip diff --git a/modules/git/log_name_status.go b/modules/git/log_name_status.go index ffd0a0991bf43..e1e117ff4b842 100644 --- a/modules/git/log_name_status.go +++ b/modules/git/log_name_status.go @@ -8,6 +8,7 @@ import ( "bufio" "bytes" "context" + "errors" "io" "path" "sort" @@ -62,9 +63,10 @@ func LogNameStatusRepo(ctx context.Context, repository, head, treepath string, p }) if err != nil { _ = stdoutWriter.CloseWithError(ConcatenateError(err, (&stderr).String())) - } else { - _ = stdoutWriter.Close() + return } + + _ = stdoutWriter.Close() }() // For simplicities sake we'll us a buffered reader to read from the cat-file --batch @@ -354,7 +356,7 @@ heaploop: } current, err := g.Next(treepath, path2idx, changed, maxpathlen) if err != nil { - if err == context.DeadlineExceeded { + if errors.Is(err, context.DeadlineExceeded) { break heaploop } g.Close() diff --git a/modules/hostmatcher/hostmatcher.go b/modules/hostmatcher/hostmatcher.go index 00bbc6cb0a83f..81c4202fcd98c 100644 --- a/modules/hostmatcher/hostmatcher.go +++ b/modules/hostmatcher/hostmatcher.go @@ -125,14 +125,14 @@ func (hl *HostMatchList) checkIP(ip net.IP) bool { // MatchHostName checks if the host matches an allow/deny(block) list func (hl *HostMatchList) MatchHostName(host string) bool { + if hl == nil { + return false + } + hostname, _, err := net.SplitHostPort(host) if err != nil { hostname = host } - - if hl == nil { - return false - } if hl.checkPattern(hostname) { return true } diff --git a/modules/nosql/manager_leveldb.go b/modules/nosql/manager_leveldb.go index d356a79bf82c2..7539952cf1c73 100644 --- a/modules/nosql/manager_leveldb.go +++ b/modules/nosql/manager_leveldb.go @@ -103,7 +103,7 @@ func (m *Manager) getLevelDB(connection string) (*leveldb.DB, error) { db, ok = m.LevelDBConnections[dataDir] if ok { db.count++ - log.Warn("Duplicate connnection to level db: %s with different connection strings. Initial connection: %s. This connection: %s", dataDir, db.name[0], connection) + log.Warn("Duplicate connection to level db: %s with different connection strings. Initial connection: %s. This connection: %s", dataDir, db.name[0], connection) db.name = append(db.name, connection) m.LevelDBConnections[connection] = db return db.db, nil diff --git a/modules/setting/database.go b/modules/setting/database.go index 87d56fbc930c1..8fdd5f2bcb2ff 100644 --- a/modules/setting/database.go +++ b/modules/setting/database.go @@ -156,6 +156,12 @@ func parsePostgreSQLHostPort(info string) (string, string) { } else if len(info) > 0 { host = info } + if host == "" { + host = "127.0.0.1" + } + if port == "" { + port = "5432" + } return host, port } @@ -173,6 +179,7 @@ func getPostgreSQLConnectionString(dbHost, dbUser, dbPasswd, dbName, dbParam, db // ParseMSSQLHostPort splits the host into host and port func ParseMSSQLHostPort(info string) (string, string) { + // the default port "0" might be related to MSSQL's dynamic port, maybe it should be double-confirmed in the future host, port := "127.0.0.1", "0" if strings.Contains(info, ":") { host = strings.Split(info, ":")[0] @@ -183,5 +190,11 @@ func ParseMSSQLHostPort(info string) (string, string) { } else if len(info) > 0 { host = info } + if host == "" { + host = "127.0.0.1" + } + if port == "" { + port = "0" + } return host, port } diff --git a/modules/web/middleware/locale.go b/modules/web/middleware/locale.go index de8e49796541b..f4018527c0295 100644 --- a/modules/web/middleware/locale.go +++ b/modules/web/middleware/locale.go @@ -60,7 +60,7 @@ func SetLocaleCookie(resp http.ResponseWriter, lang string, expiry int) { } // DeleteLocaleCookie convenience function to delete the locale cookie consistently -// Setting the lang cookie will trigger the middleware to reset the language ot previous state. +// Setting the lang cookie will trigger the middleware to reset the language to previous state. func DeleteLocaleCookie(resp http.ResponseWriter) { SetCookie(resp, "lang", "", -1, diff --git a/modules/web/routing/context.go b/modules/web/routing/context.go index d3c7759e64c9c..7e263db5a26e8 100644 --- a/modules/web/routing/context.go +++ b/modules/web/routing/context.go @@ -25,7 +25,7 @@ func UpdateFuncInfo(ctx context.Context, funcInfo *FuncInfo) { record.lock.Unlock() } -// MarkLongPolling marks the reuqest is a long-polling request, and the logger may output different message for it +// MarkLongPolling marks the request is a long-polling request, and the logger may output different message for it func MarkLongPolling(resp http.ResponseWriter, req *http.Request) { record, ok := req.Context().Value(contextKey).(*requestRecord) if !ok { diff --git a/options/gitignore/Bazel b/options/gitignore/Bazel index bc3afc20ba696..4e1d5a2ba0a42 100644 --- a/options/gitignore/Bazel +++ b/options/gitignore/Bazel @@ -6,7 +6,7 @@ /bazel-* # Directories for the Bazel IntelliJ plugin containing the generated -# IntelliJ project files and plugin configuration. Seperate directories are +# IntelliJ project files and plugin configuration. Separate directories are # for the IntelliJ, Android Studio and CLion versions of the plugin. /.ijwb/ /.aswb/ diff --git a/options/locale/locale_cs-CZ.ini b/options/locale/locale_cs-CZ.ini index 8f2288569d155..4cdc4d9874495 100644 --- a/options/locale/locale_cs-CZ.ini +++ b/options/locale/locale_cs-CZ.ini @@ -897,7 +897,6 @@ form.name_pattern_not_allowed=Vzor „%s“ není povolený v názvu repozitář need_auth=Ověření migrate_options=Možnosti migrace migrate_service=Migrační služba -migrate_options_mirror_helper=Tento repozitář bude zrcadlem migrate_options_lfs=Migrovat LFS soubory migrate_options_lfs_endpoint.label=Koncový bod LFS migrate_options_lfs_endpoint.description=Migrace se pokusí použít váš vzdálený Git pro určení LFS serveru. Můžete také zadat vlastní koncový bod, pokud jsou data LFS repozitáře uložena někde jinde. diff --git a/options/locale/locale_de-DE.ini b/options/locale/locale_de-DE.ini index b33ad8871f795..496c4e6d9899d 100644 --- a/options/locale/locale_de-DE.ini +++ b/options/locale/locale_de-DE.ini @@ -930,7 +930,6 @@ form.name_pattern_not_allowed='%s' ist nicht erlaubt für Repository-Namen. need_auth=Authentifizierung migrate_options=Migrationsoptionen migrate_service=Migrationsdienst -migrate_options_mirror_helper=Dieses Repository wird ein Mirror sein migrate_options_lfs=LFS-Dateien migrieren migrate_options_lfs_endpoint.label=LFS-Endpunkt migrate_options_lfs_endpoint.description=Migration wird versuchen, über den entfernten Git-Server den LFS-Server zu bestimmen. Du kannst auch einen eigenen Endpunkt angeben, wenn die LFS-Dateien woanders gespeichert werden. diff --git a/options/locale/locale_el-GR.ini b/options/locale/locale_el-GR.ini index dd4dea1760928..21b2d4a5b3c6c 100644 --- a/options/locale/locale_el-GR.ini +++ b/options/locale/locale_el-GR.ini @@ -930,7 +930,6 @@ form.name_pattern_not_allowed=Το μοτίβο '%s' δεν επιτρέπετα need_auth=Εξουσιοδότηση migrate_options=Επιλογές Μεταφοράς migrate_service=Υπηρεσία Μεταφοράς -migrate_options_mirror_helper=Αυτό το αποθετήριο θα είναι ένα είδωλο migrate_options_lfs=Μεταφορά αρχείων LFS migrate_options_lfs_endpoint.label=LFS Endpoint migrate_options_lfs_endpoint.description=Η μεταφορά θα προσπαθήσει να χρησιμοποιήσει το Git remote για να καθορίσει τον διακομιστή LFS. Μπορείτε επίσης να καθορίσετε ένα δικό σας endpoint αν τα δεδομένα LFS του αποθετηρίου αποθηκεύονται κάπου αλλού. diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 36e2ae677becb..9e8a0303393b6 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -932,7 +932,7 @@ form.name_pattern_not_allowed = The pattern '%s' is not allowed in a repository need_auth = Authorization migrate_options = Migration Options migrate_service = Migration Service -migrate_options_mirror_helper = This repository will be a mirror +migrate_options_mirror_helper = This repository will be a mirror migrate_options_lfs = Migrate LFS files migrate_options_lfs_endpoint.label = LFS Endpoint migrate_options_lfs_endpoint.description = Migration will attempt to use your Git remote to determine the LFS server. You can also specify a custom endpoint if the repository LFS data is stored somewhere else. @@ -1532,7 +1532,8 @@ pulls.remove_prefix = Remove %s prefix pulls.data_broken = This pull request is broken due to missing fork information. pulls.files_conflicted = This pull request has changes conflicting with the target branch. pulls.is_checking = "Merge conflict checking is in progress. Try again in few moments." -pulls.is_empty = "This branch is equal with the target branch." +pulls.is_ancestor = "This branch is already included in the target branch. There is nothing to merge." +pulls.is_empty = "The changes on this branch are already on the target branch. This will be an empty commit." pulls.required_status_check_failed = Some required checks were not successful. pulls.required_status_check_missing = Some required checks are missing. pulls.required_status_check_administrator = As an administrator, you may still merge this pull request. diff --git a/options/locale/locale_es-ES.ini b/options/locale/locale_es-ES.ini index 2a1d2d3f7eb07..724d354670443 100644 --- a/options/locale/locale_es-ES.ini +++ b/options/locale/locale_es-ES.ini @@ -932,7 +932,6 @@ form.name_pattern_not_allowed=El patrón '%s' no está permitido en un nombre de need_auth=Autorización migrate_options=Opciones de migración migrate_service=Servicio de Migración -migrate_options_mirror_helper=Este repositorio será uno replicado migrate_options_lfs=Migrar archivos LFS migrate_options_lfs_endpoint.label=Punto final de LFS migrate_options_lfs_endpoint.description=Migración intentará usar su mando Git para determinar el servidor LFS. También puede especificar un punto final personalizado si los datos LFS del repositorio se almacenan en otro lugar. diff --git a/options/locale/locale_fa-IR.ini b/options/locale/locale_fa-IR.ini index dded0bbb45b25..c7488cf0e91a9 100644 --- a/options/locale/locale_fa-IR.ini +++ b/options/locale/locale_fa-IR.ini @@ -863,7 +863,6 @@ form.name_pattern_not_allowed=الگوی %s در نام مخزن مجاز نیس need_auth=دسترسی migrate_options=تنظیمات مهاجرت migrate_service=سرویس مهاجرت -migrate_options_mirror_helper=این مخزن یک آینه خواهد بود migrate_options_lfs=مهاجرت فایلهای LFS migrate_options_lfs_endpoint.label=نشانهای پایانی LFS migrate_options_lfs_endpoint.description=Migration سعی خواهد کرد از کنترل از راه دور Git شما برای تعیین سرور LFS استفاده کند. همچنین اگر داده های LFS مخزن در جای دیگری ذخیره شده باشد، می توانید یک نقطه پایانی سفارشی را مشخص کنید. diff --git a/options/locale/locale_fr-FR.ini b/options/locale/locale_fr-FR.ini index ff1af0433069f..396ad2900b930 100644 --- a/options/locale/locale_fr-FR.ini +++ b/options/locale/locale_fr-FR.ini @@ -867,7 +867,6 @@ form.name_pattern_not_allowed="%s" n'est pas autorisé dans un nom de dépôt. need_auth=Autorisation migrate_options=Options de migration migrate_service=Service de migration -migrate_options_mirror_helper=Ce dépôt sera un miroir migrate_options_lfs=Migrer les fichiers LFS migrate_options_lfs_endpoint.label=Point d'accès LFS migrate_options_lfs_endpoint.description=La migration va tenter d'utiliser votre dépôt Git distant pour déterminer le serveur LFS. Vous pouvez également spécifier un point d'accès personnalisé si les données LFS du dépôt sont stockées ailleurs. diff --git a/options/locale/locale_it-IT.ini b/options/locale/locale_it-IT.ini index 99f9be14e2fc2..7087416f91b93 100644 --- a/options/locale/locale_it-IT.ini +++ b/options/locale/locale_it-IT.ini @@ -736,7 +736,6 @@ form.name_pattern_not_allowed=Il modello '%s' non è consentito come nome di un migrate_options=Opzioni di migrazione migrate_service=Servizio migrazione -migrate_options_mirror_helper=Questo repository sarà un mirror migrate_items=Elementi di migrazione migrate_items_wiki=Wiki migrate_items_milestones=Milestone diff --git a/options/locale/locale_ja-JP.ini b/options/locale/locale_ja-JP.ini index 746df9233d1c5..748715f4364ce 100644 --- a/options/locale/locale_ja-JP.ini +++ b/options/locale/locale_ja-JP.ini @@ -861,7 +861,9 @@ default_branch=デフォルトブランチ default_branch_helper=デフォルトブランチはプルリクエストとコードコミットのベースブランチとなります。 mirror_prune=Prune mirror_prune_desc=不要になった古いリモートトラッキング参照を削除 +mirror_interval=ミラー間隔 (有効な時間の単位は'h'、'm'、's')。 定期的な同期を無効にする場合は0。(最小間隔: %s) mirror_interval_invalid=ミラー間隔が不正です。 +mirror_sync_on_commit=コミットがプッシュされたときに同期 mirror_address=クローンするURL mirror_address_desc=必要な資格情報は「認証」セクションに設定してください。 mirror_address_url_invalid=入力したURLは無効です。 URLの構成要素はすべて正しくエスケープする必要があります。 @@ -930,7 +932,7 @@ form.name_pattern_not_allowed='%s' の形式はリポジトリ名に使用でき need_auth=認証 migrate_options=移行オプション migrate_service=移行するサービス -migrate_options_mirror_helper=このリポジトリをミラーにする +migrate_options_mirror_helper=このリポジトリをミラーにする migrate_options_lfs=LFS ファイルのマイグレート migrate_options_lfs_endpoint.label=LFS エンドポイント migrate_options_lfs_endpoint.description=マイグレーションでは、リモート側のGitをもとにLFSサーバーを決定しようとします。 リポジトリのLFSデータがほかの場所に保存されている場合は、独自のエンドポイントを指定することができます。 @@ -1301,6 +1303,7 @@ issues.previous=前ページ issues.next=次ページ issues.open_title=オープン issues.closed_title=クローズ +issues.draft_title=ドラフト issues.num_comments=%d件のコメント issues.commented_at=`が %s にコメント` issues.delete_comment_confirm=このコメントを削除してよろしいですか? diff --git a/options/locale/locale_lv-LV.ini b/options/locale/locale_lv-LV.ini index 281db89980266..b87202e2b6707 100644 --- a/options/locale/locale_lv-LV.ini +++ b/options/locale/locale_lv-LV.ini @@ -930,7 +930,6 @@ form.name_pattern_not_allowed=Repozitorija nosaukums '%s' nav atļauts. need_auth=Autorizācija migrate_options=Migrācijas opcijas migrate_service=Migrācijas serviss -migrate_options_mirror_helper=Šis repozitorijs būs spogulis migrate_options_lfs=Migrēt LFS failus migrate_options_lfs_endpoint.label=LFS galapunkts migrate_options_lfs_endpoint.description=Migrācija mēģinās izmantot attālināto URL, lai noteiktu LFS serveri. Var norādīt arī citu galapunktu, ja repozitorija LFS dati ir izvietoti citā vietā. diff --git a/options/locale/locale_nl-NL.ini b/options/locale/locale_nl-NL.ini index f3fc3ae335620..ccdf978800895 100644 --- a/options/locale/locale_nl-NL.ini +++ b/options/locale/locale_nl-NL.ini @@ -754,7 +754,6 @@ form.name_pattern_not_allowed=Het patroon '%s' is niet toegestaan in de naam van migrate_options=Migratie opties migrate_service=Migratie Service -migrate_options_mirror_helper=Deze repository zal een kopie zijn migrate_items=Migratie Items migrate_items_wiki=Wiki migrate_items_milestones=Mijlpalen diff --git a/options/locale/locale_pl-PL.ini b/options/locale/locale_pl-PL.ini index 0d9a596e39281..3b65957bf5a91 100644 --- a/options/locale/locale_pl-PL.ini +++ b/options/locale/locale_pl-PL.ini @@ -870,7 +870,6 @@ form.name_pattern_not_allowed=Wzór "%s" nie jest dozwolony w nazwie repozytoriu need_auth=Autoryzacja migrate_options=Opcje migracji migrate_service=Usługa migracji -migrate_options_mirror_helper=To repozytorium będzie kopią lustrzaną migrate_options_lfs=Migruj pliki LFS migrate_options_lfs_endpoint.label=Punkt końcowy LFS migrate_options_lfs_endpoint.description=Migracja spróbuje użyć Git remote, aby określić serwer LFS. Możesz również określić niestandardowy punkt końcowy, jeśli dane repozytorium LFS są przechowywane gdzieś indziej. diff --git a/options/locale/locale_pt-BR.ini b/options/locale/locale_pt-BR.ini index a91847b68a24f..3bf98901acf47 100644 --- a/options/locale/locale_pt-BR.ini +++ b/options/locale/locale_pt-BR.ini @@ -930,7 +930,6 @@ form.name_pattern_not_allowed=O padrão de '%s' não é permitido em um nome de need_auth=Autorização migrate_options=Opções de Migração migrate_service=Serviço de Migração -migrate_options_mirror_helper=Este repositório será um espelho migrate_options_lfs=Migrar arquivos LFS migrate_options_lfs_endpoint.label=Destino LFS migrate_options_lfs_endpoint.description=A migração tentará usar seu controle remoto Git para determinar o servidor LFS. Você também pode especificar um destino personalizado se os dados do repositório LFS forem armazenados em outro lugar. diff --git a/options/locale/locale_pt-PT.ini b/options/locale/locale_pt-PT.ini index b44b383548e27..176537129ccca 100644 --- a/options/locale/locale_pt-PT.ini +++ b/options/locale/locale_pt-PT.ini @@ -932,7 +932,7 @@ form.name_pattern_not_allowed=O padrão '%s' não é permitido no nome de um rep need_auth=Autorização migrate_options=Opções de migração migrate_service=Serviço de migração -migrate_options_mirror_helper=Este repositório irá ser uma réplica +migrate_options_mirror_helper=Este repositório irá ser uma réplica migrate_options_lfs=Migrar ficheiros LFS migrate_options_lfs_endpoint.label=Destino LFS migrate_options_lfs_endpoint.description=A migração irá tentar usar o seu controlo remoto do Git para determinar o servidor LFS. Também pode especificar um destino personalizado se os dados do repositório LFS forem armazenados noutro lugar. diff --git a/options/locale/locale_ru-RU.ini b/options/locale/locale_ru-RU.ini index 28c8a01fa2418..555959b5124c9 100644 --- a/options/locale/locale_ru-RU.ini +++ b/options/locale/locale_ru-RU.ini @@ -918,7 +918,6 @@ form.name_pattern_not_allowed=Шаблон имени репозитория '%s need_auth=Авторизация migrate_options=Параметры миграции migrate_service=Сервис миграции -migrate_options_mirror_helper=Этот репозиторий будет зеркалом migrate_options_lfs=Перенос LFS файлов migrate_options_lfs_endpoint.label=LFS Endpoint migrate_options_lfs_endpoint.description=Миграция попытается использовать ваш Git удаленно, чтобы определить сервер LFS. Вы также можете указать пользовательскую конечную точку, если данные хранятся в другом месте. diff --git a/options/locale/locale_sv-SE.ini b/options/locale/locale_sv-SE.ini index b82b0d9f65b98..e8458136b50da 100644 --- a/options/locale/locale_sv-SE.ini +++ b/options/locale/locale_sv-SE.ini @@ -700,7 +700,6 @@ form.name_pattern_not_allowed=Mönstret '%s' är otillåtet i ett utvecklingskat migrate_options=Migrationsalternativ migrate_service=Migreringstjänst -migrate_options_mirror_helper=Denna utvecklingskatalog kommer att vara en spegel migrate_items=Migrationsobjekt migrate_items_wiki=Wiki migrate_items_milestones=Milstenar diff --git a/options/locale/locale_tr-TR.ini b/options/locale/locale_tr-TR.ini index 9b8a19c802a7b..6d3e03c2461aa 100644 --- a/options/locale/locale_tr-TR.ini +++ b/options/locale/locale_tr-TR.ini @@ -846,7 +846,6 @@ form.name_pattern_not_allowed='%s' deseni, depo adı için geçerli değildir. need_auth=Yetkilendirme migrate_options=Göç Seçenekleri migrate_service=Göç Hizmeti -migrate_options_mirror_helper=Bu depo bir yansı olacaktır migrate_options_lfs=LFS dosyalarını taşı migrate_options_lfs_endpoint.label=LFS Uç Noktası migrate_options_lfs_endpoint.description=Taşıma, LFS sunucusunu belirlemek için Git uzak sunucusunu kullanmaya çalışacak. Eğer LFS veri deposu başka yerdeyse özel bir uç nokta da belirtebilirsiniz. diff --git a/options/locale/locale_uk-UA.ini b/options/locale/locale_uk-UA.ini index f5cf9e93d09f2..460ab2192cc24 100644 --- a/options/locale/locale_uk-UA.ini +++ b/options/locale/locale_uk-UA.ini @@ -870,7 +870,6 @@ form.name_pattern_not_allowed=Шаблон '%s' не дозволено в на need_auth=Авторизація migrate_options=Параметри міграції migrate_service=Сервіс міграції -migrate_options_mirror_helper=Цей репозиторій буде дзеркалом migrate_options_lfs=Перенесення LFS файлів migrate_options_lfs_endpoint.label=Кінцева точка LFS migrate_options_lfs_endpoint.description=Міграція буде намагатися використовувати ваш Git віддалено, щоб визначати LFS сервер. Ви також можете вказати свою кінцеву точку, якщо дані репозиторію LFS зберігаються в іншому місці. diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index afb408f41cd70..eec7c0ba596ee 100644 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -932,7 +932,6 @@ form.name_pattern_not_allowed=仓库名称中不允许使用模式 "%s"。 need_auth=授权 migrate_options=迁移选项 migrate_service=迁移服务 -migrate_options_mirror_helper=该仓库将是一个 镜像 migrate_options_lfs=迁移 LFS 文件 migrate_options_lfs_endpoint.label=LFS 网址 migrate_options_lfs_endpoint.description=迁移将尝试使用你的 Git remote 来 确定 LFS 服务器。如果仓库 LFS 数据存储在其他位置,你还可以指定自定义网址。 diff --git a/options/locale/locale_zh-TW.ini b/options/locale/locale_zh-TW.ini index d84267fe66e74..3dcd5ecd04012 100644 --- a/options/locale/locale_zh-TW.ini +++ b/options/locale/locale_zh-TW.ini @@ -930,7 +930,6 @@ form.name_pattern_not_allowed=儲存庫名稱不可包含字元「%s」。 need_auth=授權 migrate_options=遷移選項 migrate_service=遷移服務 -migrate_options_mirror_helper=將此儲存庫設定為鏡像儲存庫 migrate_options_lfs=遷移 LFS 檔案 migrate_options_lfs_endpoint.label=LFS 端點 migrate_options_lfs_endpoint.description=遷移將會嘗試使用您的 Git Remote 來確認 LFS 伺服器。如果存儲庫的 LFS 資料放在其他地方,您也可以指定自訂的端點。 diff --git a/routers/api/packages/composer/api.go b/routers/api/packages/composer/api.go index d8f67d130cd09..5e1cc293da0f8 100644 --- a/routers/api/packages/composer/api.go +++ b/routers/api/packages/composer/api.go @@ -76,7 +76,7 @@ type PackageVersionMetadata struct { Dist Dist `json:"dist"` } -// Dist contains package download informations +// Dist contains package download information type Dist struct { Type string `json:"type"` URL string `json:"url"` diff --git a/routers/api/packages/conan/conan.go b/routers/api/packages/conan/conan.go index 0a27f18fd1ee9..04b0bb6cdd9b2 100644 --- a/routers/api/packages/conan/conan.go +++ b/routers/api/packages/conan/conan.go @@ -429,14 +429,14 @@ func uploadFile(ctx *context.Context, fileFilter stringSet, fileKey string) { ctx.Status(http.StatusCreated) } -// DownloadRecipeFile serves the conent of the requested recipe file +// DownloadRecipeFile serves the content of the requested recipe file func DownloadRecipeFile(ctx *context.Context) { rref := ctx.Data[recipeReferenceKey].(*conan_module.RecipeReference) downloadFile(ctx, recipeFileList, rref.AsKey()) } -// DownloadPackageFile serves the conent of the requested package file +// DownloadPackageFile serves the content of the requested package file func DownloadPackageFile(ctx *context.Context) { pref := ctx.Data[packageReferenceKey].(*conan_module.PackageReference) diff --git a/routers/api/packages/rubygems/rubygems.go b/routers/api/packages/rubygems/rubygems.go index 6fdd03e8ea704..b3815a914ea7e 100644 --- a/routers/api/packages/rubygems/rubygems.go +++ b/routers/api/packages/rubygems/rubygems.go @@ -37,7 +37,7 @@ func EnumeratePackages(ctx *context.Context) { enumeratePackages(ctx, "specs.4.8", packages) } -// EnumeratePackagesLatest serves the list of the lastest version of every package +// EnumeratePackagesLatest serves the list of the latest version of every package func EnumeratePackagesLatest(ctx *context.Context) { pvs, _, err := packages_model.SearchLatestVersions(ctx, &packages_model.PackageSearchOptions{ OwnerID: ctx.Package.Owner.ID, diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go index c93606ae88308..44e0c290a0881 100644 --- a/routers/api/v1/api.go +++ b/routers/api/v1/api.go @@ -1017,7 +1017,7 @@ func Routes() *web.Route { }, mustAllowPulls, reqRepoReader(unit.TypeCode), context.ReferencesGitRepo()) m.Group("/statuses", func() { m.Combo("/{sha}").Get(repo.GetCommitStatuses). - Post(reqToken(), bind(api.CreateStatusOption{}), repo.NewCommitStatus) + Post(reqToken(), reqRepoWriter(unit.TypeCode), bind(api.CreateStatusOption{}), repo.NewCommitStatus) }, reqRepoReader(unit.TypeCode)) m.Group("/commits", func() { m.Get("", context.ReferencesGitRepo(), repo.GetAllCommits) diff --git a/routers/api/v1/repo/topic.go b/routers/api/v1/repo/topic.go index 1cc2c50dc20d8..64dc763dc3811 100644 --- a/routers/api/v1/repo/topic.go +++ b/routers/api/v1/repo/topic.go @@ -240,6 +240,7 @@ func DeleteTopic(ctx *context.APIContext) { if topic == nil { ctx.NotFound() + return } ctx.Status(http.StatusNoContent) diff --git a/routers/web/repo/pull.go b/routers/web/repo/pull.go index 6e8f575ad54a5..2a961c3cbc554 100644 --- a/routers/web/repo/pull.go +++ b/routers/web/repo/pull.go @@ -1440,7 +1440,7 @@ func UpdatePullRequestTarget(ctx *context.Context) { err := err.(issues_model.ErrPullRequestAlreadyExists) RepoRelPath := ctx.Repo.Owner.Name + "/" + ctx.Repo.Repository.Name - errorMessage := ctx.Tr("repo.pulls.has_pull_request", html.EscapeString(ctx.Repo.RepoLink+"/pulls/"+strconv.FormatInt(err.IssueID, 10)), html.EscapeString(RepoRelPath), err.IssueID) // FIXME: Creates url insidde locale string + errorMessage := ctx.Tr("repo.pulls.has_pull_request", html.EscapeString(ctx.Repo.RepoLink+"/pulls/"+strconv.FormatInt(err.IssueID, 10)), html.EscapeString(RepoRelPath), err.IssueID) // FIXME: Creates url inside locale string ctx.Flash.Error(errorMessage) ctx.JSON(http.StatusConflict, map[string]interface{}{ diff --git a/routers/web/repo/release.go b/routers/web/repo/release.go index df953fd0b95f7..ab87c3e2385af 100644 --- a/routers/web/repo/release.go +++ b/routers/web/repo/release.go @@ -98,8 +98,8 @@ func releasesOrTags(ctx *context.Context, isTagList bool) { listOptions.PageSize = setting.API.MaxResponseItems } - // TODO(20073) tags are used for compare feature witch needs all tags - // filtering is doen at the client side atm + // TODO(20073) tags are used for compare feature which needs all tags + // filtering is done on the client-side atm tagListStart, tagListEnd := 0, 0 if isTagList { tagListStart, tagListEnd = listOptions.GetStartEnd() @@ -514,12 +514,12 @@ func EditReleasePost(ctx *context.Context) { ctx.Redirect(ctx.Repo.RepoLink + "/releases") } -// DeleteRelease delete a release +// DeleteRelease deletes a release func DeleteRelease(ctx *context.Context) { deleteReleaseOrTag(ctx, false) } -// DeleteTag delete a tag +// DeleteTag deletes a tag func DeleteTag(ctx *context.Context) { deleteReleaseOrTag(ctx, true) } diff --git a/routers/web/web.go b/routers/web/web.go index 1b6dd03bc8a84..ae273d99e4ffd 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -85,7 +85,7 @@ func CorsHandler() func(next http.Handler) http.Handler { // for users that have already signed in. func buildAuthGroup() *auth_service.Group { group := auth_service.NewGroup( - &auth_service.OAuth2{}, // FIXME: this should be removed and only applied in download and oauth realted routers + &auth_service.OAuth2{}, // FIXME: this should be removed and only applied in download and oauth related routers &auth_service.Basic{}, // FIXME: this should be removed and only applied in download and git/lfs routers &auth_service.Session{}, ) diff --git a/routers/web/webfinger.go b/routers/web/webfinger.go index c4808fbfd2419..972182becee72 100644 --- a/routers/web/webfinger.go +++ b/routers/web/webfinger.go @@ -33,7 +33,7 @@ type webfingerLink struct { Properties map[string]interface{} `json:"properties,omitempty"` } -// WebfingerQuery returns informations about a resource +// WebfingerQuery returns information about a resource // https://datatracker.ietf.org/doc/html/rfc7565 func WebfingerQuery(ctx *context.Context) { appURL, _ := url.Parse(setting.AppURL) diff --git a/services/auth/source/oauth2/providers.go b/services/auth/source/oauth2/providers.go index 45851c879990d..aa3ee3842ddb4 100644 --- a/services/auth/source/oauth2/providers.go +++ b/services/auth/source/oauth2/providers.go @@ -35,7 +35,7 @@ type GothProvider interface { GothProviderCreator } -// ImagedProvider provide an overrided image setting for the provider +// ImagedProvider provide an overridden image setting for the provider type ImagedProvider struct { GothProvider image string diff --git a/services/migrations/gitea_uploader.go b/services/migrations/gitea_uploader.go index e71b2ca17af35..c7a6f9b02f2c3 100644 --- a/services/migrations/gitea_uploader.go +++ b/services/migrations/gitea_uploader.go @@ -7,7 +7,6 @@ package migrations import ( "context" - "errors" "fmt" "io" "os" @@ -268,7 +267,7 @@ func (g *GiteaLocalUploader) CreateReleases(releases ...*base.Release) error { // calc NumCommits if possible if rel.TagName != "" { commit, err := g.gitRepo.GetTagCommit(rel.TagName) - if !errors.Is(err, git.ErrNotExist{}) { + if !git.IsErrNotExist(err) { if err != nil { return fmt.Errorf("GetTagCommit[%v]: %v", rel.TagName, err) } diff --git a/services/migrations/migrate.go b/services/migrations/migrate.go index ce76733bd51a8..f2542173a0ee6 100644 --- a/services/migrations/migrate.go +++ b/services/migrations/migrate.go @@ -84,7 +84,10 @@ func IsMigrateURLAllowed(remoteURL string, doer *user_model.User) error { // some users only use proxy, there is no DNS resolver. it's safe to ignore the LookupIP error addrList, _ := net.LookupIP(hostName) + return checkByAllowBlockList(hostName, addrList) +} +func checkByAllowBlockList(hostName string, addrList []net.IP) error { var ipAllowed bool var ipBlocked bool for _, addr := range addrList { @@ -93,12 +96,12 @@ func IsMigrateURLAllowed(remoteURL string, doer *user_model.User) error { } var blockedError error if blockList.MatchHostName(hostName) || ipBlocked { - blockedError = &models.ErrInvalidCloneAddr{Host: u.Host, IsPermissionDenied: true} + blockedError = &models.ErrInvalidCloneAddr{Host: hostName, IsPermissionDenied: true} } - // if we have an allow-list, check the allow-list first + // if we have an allow-list, check the allow-list before return to get the more accurate error if !allowList.IsEmpty() { if !allowList.MatchHostName(hostName) && !ipAllowed { - return &models.ErrInvalidCloneAddr{Host: u.Host, IsPermissionDenied: true} + return &models.ErrInvalidCloneAddr{Host: hostName, IsPermissionDenied: true} } } // otherwise, we always follow the blocked list @@ -474,5 +477,7 @@ func Init() error { allowList.AppendBuiltin(hostmatcher.MatchBuiltinPrivate) allowList.AppendBuiltin(hostmatcher.MatchBuiltinLoopback) } + // TODO: at the moment, if ALLOW_LOCALNETWORKS=false, ALLOWED_DOMAINS=domain.com, and domain.com has IP 127.0.0.1, then it's still allowed. + // if we want to block such case, the private&loopback should be added to the blockList when ALLOW_LOCALNETWORKS=false return nil } diff --git a/services/migrations/migrate_test.go b/services/migrations/migrate_test.go index d09c184d91e0d..53cfe6d3ebe84 100644 --- a/services/migrations/migrate_test.go +++ b/services/migrations/migrate_test.go @@ -5,6 +5,7 @@ package migrations import ( + "net" "path/filepath" "testing" @@ -74,3 +75,42 @@ func TestMigrateWhiteBlocklist(t *testing.T) { setting.ImportLocalPaths = old } + +func TestAllowBlockList(t *testing.T) { + init := func(allow, block string, local bool) { + setting.Migrations.AllowedDomains = allow + setting.Migrations.BlockedDomains = block + setting.Migrations.AllowLocalNetworks = local + assert.NoError(t, Init()) + } + + // default, allow all external, block none, no local networks + init("", "", false) + assert.NoError(t, checkByAllowBlockList("domain.com", []net.IP{net.ParseIP("1.2.3.4")})) + assert.Error(t, checkByAllowBlockList("domain.com", []net.IP{net.ParseIP("127.0.0.1")})) + + // allow all including local networks (it could lead to SSRF in production) + init("", "", true) + assert.NoError(t, checkByAllowBlockList("domain.com", []net.IP{net.ParseIP("1.2.3.4")})) + assert.NoError(t, checkByAllowBlockList("domain.com", []net.IP{net.ParseIP("127.0.0.1")})) + + // allow wildcard, block some subdomains. if the domain name is allowed, then the local network check is skipped + init("*.domain.com", "blocked.domain.com", false) + assert.NoError(t, checkByAllowBlockList("sub.domain.com", []net.IP{net.ParseIP("1.2.3.4")})) + assert.NoError(t, checkByAllowBlockList("sub.domain.com", []net.IP{net.ParseIP("127.0.0.1")})) + assert.Error(t, checkByAllowBlockList("blocked.domain.com", []net.IP{net.ParseIP("1.2.3.4")})) + assert.Error(t, checkByAllowBlockList("sub.other.com", []net.IP{net.ParseIP("1.2.3.4")})) + + // allow wildcard (it could lead to SSRF in production) + init("*", "", false) + assert.NoError(t, checkByAllowBlockList("domain.com", []net.IP{net.ParseIP("1.2.3.4")})) + assert.NoError(t, checkByAllowBlockList("domain.com", []net.IP{net.ParseIP("127.0.0.1")})) + + // local network can still be blocked + init("*", "127.0.0.*", false) + assert.NoError(t, checkByAllowBlockList("domain.com", []net.IP{net.ParseIP("1.2.3.4")})) + assert.Error(t, checkByAllowBlockList("domain.com", []net.IP{net.ParseIP("127.0.0.1")})) + + // reset + init("", "", false) +} diff --git a/services/pull/check.go b/services/pull/check.go index 6621a281fa543..288f4dc0b73b7 100644 --- a/services/pull/check.go +++ b/services/pull/check.go @@ -89,7 +89,7 @@ func CheckPullMergable(stdCtx context.Context, doer *user_model.User, perm *acce return ErrIsWorkInProgress } - if !pr.CanAutoMerge() { + if !pr.CanAutoMerge() && !pr.IsEmpty() { return ErrNotMergableState } diff --git a/services/pull/patch.go b/services/pull/patch.go index c7a69501c32f0..bb09acc89f63a 100644 --- a/services/pull/patch.go +++ b/services/pull/patch.go @@ -87,6 +87,14 @@ func TestPatch(pr *issues_model.PullRequest) error { } } pr.MergeBase = strings.TrimSpace(pr.MergeBase) + if pr.HeadCommitID, err = gitRepo.GetRefCommitID(git.BranchPrefix + "tracking"); err != nil { + return fmt.Errorf("GetBranchCommitID: can't find commit ID for head: %w", err) + } + + if pr.HeadCommitID == pr.MergeBase { + pr.Status = issues_model.PullRequestStatusAncestor + return nil + } // 2. Check for conflicts if conflicts, err := checkConflicts(ctx, pr, gitRepo, tmpBasePath); err != nil || conflicts || pr.Status == issues_model.PullRequestStatusEmpty { diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl index 7ed73e1176f52..60fe667a54899 100644 --- a/templates/repo/issue/view_content/pull.tmpl +++ b/templates/repo/issue/view_content/pull.tmpl @@ -195,12 +195,12 @@ {{svg "octicon-sync"}} {{$.locale.Tr "repo.pulls.is_checking"}} - {{else if .Issue.PullRequest.IsEmpty}} + {{else if .Issue.PullRequest.IsAncestor}}
{{svg "octicon-alert" 16}} - {{$.locale.Tr "repo.pulls.is_empty"}} + {{$.locale.Tr "repo.pulls.is_ancestor"}}
- {{else if .Issue.PullRequest.CanAutoMerge}} + {{else if or .Issue.PullRequest.CanAutoMerge .Issue.PullRequest.IsEmpty}} {{if .IsBlockedByApprovals}}
{{svg "octicon-x"}} @@ -254,7 +254,7 @@ {{$notAllOverridableChecksOk := or .IsBlockedByApprovals .IsBlockedByRejection .IsBlockedByOfficialReviewRequests .IsBlockedByOutdatedBranch .IsBlockedByChangedProtectedFiles (and .EnableStatusCheck (not .RequiredStatusCheckState.IsSuccess))}} - {{/* admin can merge without checks, writer can merge when checkes succeed */}} + {{/* admin can merge without checks, writer can merge when checks succeed */}} {{$canMergeNow := and (or $.IsRepoAdmin (not $notAllOverridableChecksOk)) (or (not .AllowMerge) (not .RequireSigned) .WillSign)}} {{/* admin and writer both can make an auto merge schedule */}} @@ -282,7 +282,6 @@
{{end}} {{end}} - {{if and (gt .Issue.PullRequest.CommitsBehind 0) (not .Issue.IsClosed) (not .Issue.PullRequest.IsChecking) (not .IsPullFilesConflicted) (not .IsPullRequestBroken) (not $canAutoMerge)}}
@@ -321,6 +320,14 @@
{{end}} + {{if .Issue.PullRequest.IsEmpty}} +
+ +
+ {{svg "octicon-alert" 16}} + {{$.locale.Tr "repo.pulls.is_empty"}} +
+ {{end}} {{if .AllowMerge}} {{/* user is allowed to merge */}} {{$prUnit := .Repository.MustGetUnit $.UnitTypePullRequests}} @@ -348,6 +355,7 @@ 'canMergeNow': {{$canMergeNow}}, 'allOverridableChecksOk': {{not $notAllOverridableChecksOk}}, + 'emptyCommit': {{.Issue.PullRequest.IsEmpty}}, 'pullHeadCommitID': {{.PullHeadCommitID}}, 'isPullBranchDeletable': {{.IsPullBranchDeletable}}, 'defaultDeleteBranchAfterMerge': {{$prUnit.PullRequestsConfig.DefaultDeleteBranchAfterMerge}}, diff --git a/templates/repo/migrate/options.tmpl b/templates/repo/migrate/options.tmpl index 62e92dc135259..5fdf6c7ab447f 100644 --- a/templates/repo/migrate/options.tmpl +++ b/templates/repo/migrate/options.tmpl @@ -3,7 +3,7 @@
- +
{{end}} diff --git a/templates/user/settings/repos.tmpl b/templates/user/settings/repos.tmpl index eba0d22d5eea8..aedff91de9014 100644 --- a/templates/user/settings/repos.tmpl +++ b/templates/user/settings/repos.tmpl @@ -109,15 +109,15 @@
{{if .IsPrivate}} - {{svg "octicon-lock"}} + {{svg "octicon-lock" 16 "mr-2 iconFloat text gold"}} {{else if .IsFork}} - {{svg "octicon-repo-forked"}} + {{svg "octicon-repo-forked" 16 "mr-2 iconFloat"}} {{else if .IsMirror}} - {{svg "octicon-mirror"}} + {{svg "octicon-mirror" 16 "mr-2 iconFloat"}} {{else if .IsTemplate}} - {{svg "octicon-repo-template"}} + {{svg "octicon-repo-template" 16 "mr-2 iconFloat"}} {{else}} - {{svg "octicon-repo"}} + {{svg "octicon-repo" 16 "mr-2 iconFloat"}} {{end}} {{.OwnerName}}/{{.Name}} {{FileSize .Size}} diff --git a/web_src/js/components/PullRequestMergeForm.vue b/web_src/js/components/PullRequestMergeForm.vue index 75fbceb8007a7..08b1f9cb86e90 100644 --- a/web_src/js/components/PullRequestMergeForm.vue +++ b/web_src/js/components/PullRequestMergeForm.vue @@ -48,7 +48,7 @@
-
+