Commit graph

16993 commits

Author SHA1 Message Date
Giteabot 31c4a80979
Make gogit Repository.GetBranchNames consistent (#28348) (#28386)
Backport #28348 by @AdamMajer

nogogit GetBranchNames() lists branches sorted in reverse commit date
order. On the other hand the gogit implementation doesn't apply any
ordering resulting in unpredictable behaviour. In my case, the unit
tests requiring particular order fail

    repo_branch_test.go:24:
                Error Trace:
               ./gitea/modules/git/repo_branch_test.go:24
                Error:          elements differ

                                extra elements in list A:
                                ([]interface {}) (len=1) {
                                 (string) (len=6) "master"
                                }

                                extra elements in list B:
                                ([]interface {}) (len=1) {
                                 (string) (len=7) "branch1"
                                }

                                listA:
                                ([]string) (len=2) {
                                 (string) (len=6) "master",
                                 (string) (len=7) "branch2"
                                }

                                listB:
                                ([]string) (len=2) {
                                 (string) (len=7) "branch1",
                                 (string) (len=7) "branch2"
                                }
                Test:           TestRepository_GetBranches

To fix this, we sort branches based on their commit date in gogit
implementation.

Fixes: #28318

Co-authored-by: Adam Majer <amajer@suse.de>
(cherry picked from commit 272ae03341)
2023-12-08 13:41:16 +01:00
Giteabot 91e49c45ec
Fix margin in server signed signature verification view (#28379) (#28381)
Backport #28379 by @lafriks

Before:

![image](https://github.com/go-gitea/gitea/assets/165205/e2e2256d-03c5-4ab8-8ed9-08ef68571a43)

After:

![image](https://github.com/go-gitea/gitea/assets/165205/804132ef-18f9-4ab8-949d-f6c71e7f4d24)

Co-authored-by: Lauris BH <lauris@nix.lv>
(cherry picked from commit b56a9f6ded)
2023-12-08 13:41:16 +01:00
Giteabot 1ce155c5a6
Fix object does not exist error when checking citation file (#28314) (#28369)
Backport #28314 by @yp05327

Fix #28264

`DataAsync()` will be called twice.
Caused by https://github.com/go-gitea/gitea/pull/27958.
I'm sorry, I didn't completely remove all unnecessary codes.

Co-authored-by: yp05327 <576951401@qq.com>
(cherry picked from commit c5c44d0951)
2023-12-08 13:41:16 +01:00
Giteabot 52f8fde69f
Fix incorrect default value of [attachment].MAX_SIZE (#28373) (#28376)
Backport #28373 by @capvor

In the documents, the `[attachment] MAX_SIZE` default value should be 4.

Reference the source code `modules/setting/attachment.go` line 29.

Co-authored-by: capvor <capvor@sina.com>
(cherry picked from commit 8f2805f757)
2023-12-08 13:41:16 +01:00
Giteabot f484ad6a29
Use filepath instead of path to create SQLite3 database file (#28374) (#28378)
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Fix #28300

(cherry picked from commit 5eaf91e919)
2023-12-08 13:41:16 +01:00
Giteabot 3a788340f0
Fix the runs will not be displayed bug when the main branch have no workflows but other branches have (#28359) (#28365)
Backport #28359 by @lunny

The left menu will only display the default branch's workflows but the
right side will display the runs triggered by all branches' workflows.
So we cannot hide right side if default branch has no workflows.

Fix #28332
Replace #28333

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
(cherry picked from commit b7e3adc66c)
2023-12-08 13:41:16 +01:00
Giteabot 6812c5d634
handle repository.size column being NULL in migration v263 (#28336) (#28363)
Co-authored-by: Nate Levesque <nate@thenaterhood.com>
(cherry picked from commit 5b5f8aab19)
2023-12-08 13:41:16 +01:00
Giteabot 346635605d
Convert git commit summary to valid UTF8. (#28356) (#28358)
Backport #28356 by @darrinsmart

The summary string ends up in the database, and (at least) MySQL &
PostgreSQL require valid UTF8 strings.

Fixes #28178

Co-authored-by: darrinsmart <darrin@djs.to>
Co-authored-by: Darrin Smart <darrin@filmlight.ltd.uk>
(cherry picked from commit fef34790bb)
2023-12-08 13:41:16 +01:00
Giteabot 693c2b4f15
Fix migration panic due to an empty review comment diff (#28334) (#28362)
Backport #28334 by @lng2020

Fix #28328
```
func (p *PullRequestComment) GetDiffHunk() string {
	if p == nil || p.DiffHunk == nil {
		return ""
	}
	return *p.DiffHunk
}
```
This function in the package `go-github` may return an empty diff. When
it's empty, the following code will panic because it access `ss[1]`

ec1feedbf5/services/migrations/gitea_uploader.go (L861-L867)

ec1feedbf5/modules/git/diff.go (L97-L101)

Co-authored-by: Nanguan Lin <70063547+lng2020@users.noreply.github.com>
(cherry picked from commit 8b590de186)
2023-12-08 13:41:16 +01:00
Giteabot ce3a24ef5f
Add HEAD support for rpm repo files (#28309) (#28360)
Backport #28309 by @KN4CK3R

Fixes https://codeberg.org/forgejo/forgejo/issues/1810

zypper uses HEAD requests to check file existence.

https://github.com/openSUSE/libzypp/blob/HEAD/zypp/RepoManager.cc#L2549

https://github.com/openSUSE/libzypp/blob/HEAD/zypp-curl/ng/network/private/downloaderstates/basicdownloader_p.cc#L116

@ExplodingDragon fyi

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
(cherry picked from commit 5105d2093c)
2023-12-08 13:41:16 +01:00
Giteabot 171b6a294f
Refactor template empty checks (#28351) (#28354)
Backport #28351 by @KN4CK3R

Fix #28347

As there is no info how to reproduce it, I can't test it.
Fix may be `section_split.tmpl @ 126/130`.

Other changes are "empty check" refactorings.

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
(cherry picked from commit 08445d5d86)
2023-12-08 13:41:16 +01:00
Giteabot b1b0d9a3fe
Fix RPM/Debian signature key creation (#28352) (#28353)
Backport #28352 by @KN4CK3R

Fixes #28324

The name parameter can't contain some characters
(https://github.com/keybase/go-crypto/blob/master/openpgp/keys.go#L680)
but is optional. Therefore just use an empty string.

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
(cherry picked from commit b71d4c3ec0)
2023-12-08 13:41:16 +01:00
Giteabot 8c3e66d604
Keep profile tab when clicking on Language (#28320) (#28331)
Backport #28320 by @JakobDev

Fixes https://codeberg.org/Codeberg/Community/issues/1355

Co-authored-by: JakobDev <jakobdev@gmx.de>
(cherry picked from commit bf537adf8a)
2023-12-08 13:41:16 +01:00
Giteabot 599211efe4
Fix missing issue search index update when changing status (#28325) (#28330)
Backport #28325 by @brechtvl

Changing an issue status, assignee, labels or milestone without also
adding a comment would not update the index, resulting in wrong search
results.

Co-authored-by: Brecht Van Lommel <brecht@blender.org>
(cherry picked from commit 8c8c24f8eb)
2023-12-08 13:41:16 +01:00
Giteabot 69bb6c6d71
Fix wrong link in protect_branch_name_pattern_desc (#28313) (#28315)
Backport #28313 by @yp05327

The current href will link to
`https://domain/owner/repo/settings/branches/github.com/gobwas/glob`

Co-authored-by: yp05327 <576951401@qq.com>
(cherry picked from commit fee9c05ed3)
2023-12-08 13:41:16 +01:00
Giteabot b69ad623c2
Read previous info from git blame (#28306) (#28310)
Backport #28306 by @KN4CK3R

Fixes #28280

Reads the `previous` info from the `git blame` output instead of
calculating it afterwards.

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
(cherry picked from commit e15fe85335)
2023-12-08 13:41:16 +01:00
wxiaoguang 6cc02cdfd4
Ignore "non-existing" errors when getDirectorySize calculates the size (#28276) (#28285)
Backport #28276

The git command may operate the git directory (add/remove) files in any
time.

So when the code iterates the directory, some files may disappear during
the "walk". All "IsNotExist" errors should be ignored.

(cherry picked from commit 4f5122a7fe)
2023-12-08 13:41:16 +01:00
Giteabot 8aee1ae8e9
Use appSubUrl for OAuth2 callback URL tip (#28266) (#28275)
Backport #28266 by @earl-warren

- When crafting the OAuth2 callbackURL take into account `appSubUrl`,
which is quite safe given that its strictly formatted.
- No integration testing as this is all done in Javascript.
- Resolves https://codeberg.org/forgejo/forgejo/issues/1795

(cherry picked from commit 27cb6b7956)

Co-authored-by: Earl Warren <109468362+earl-warren@users.noreply.github.com>
Co-authored-by: Gusted <postmaster@gusted.xyz>
(cherry picked from commit 84e65afffd)
2023-12-08 13:41:15 +01:00
Giteabot 13c0df40de
Meilisearch: require all query terms to be matched (#28293) (#28296)
Co-authored-by: Brecht Van Lommel <brecht@blender.org>
(cherry picked from commit d2908b2794)
2023-12-08 13:41:15 +01:00
Giteabot 694f748f38
Fix issue will be detected as pull request when checking First-time contributor (#28237) (#28271)
Backport #28237 by @yp05327

Fix #28224

Co-authored-by: yp05327 <576951401@qq.com>
(cherry picked from commit 76e892317b)
2023-12-08 13:40:59 +01:00
Giteabot 93c3924a56
Check for v prefix on tags for release clean name (#28257) (#28270)
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
(cherry picked from commit 5001f63c07)
2023-12-08 13:40:59 +01:00
Giteabot 6ffcb5f5a5
Use full width for project boards (#28225) (#28245)
Backport #28225 by @denyskon

Inspired by #28182

Co-authored-by: Denys Konovalov <kontakt@denyskon.de>
(cherry picked from commit 6d22ca15ab)
2023-12-08 13:40:59 +01:00
Giteabot b63749b94c
Increase "version" when update the setting value to a same value as before (#28243) (#28244)
Backport #28243

Setting the same value should not trigger DuplicateKey error, and the
"version" should be increased

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
(cherry picked from commit ea9f5a57e4)
2023-12-08 13:40:59 +01:00
yp05327 ce5260565c
Revert move installation/upgrade-from-gogs.md in 1.21 (#28235)
https://github.com/go-gitea/gitea/pull/28233#discussion_r1405539630
(cherry picked from commit 96141e4e55)
2023-12-08 13:40:59 +01:00
Giteabot 897f20d3ed
Fix links in docs (#28234) (#28238)
Backport #28234 by @yp05327

Follow #28191

Changes:
- `(doc/administration/config-cheat-sheet.md` is incorrect:

![image](https://github.com/go-gitea/gitea/assets/18380374/1c417dd7-61a0-49ba-8d50-871fd4c9bf20)
- remove `../../`

Co-authored-by: yp05327 <576951401@qq.com>
(cherry picked from commit ca5f0c93c6)
2023-12-08 13:40:59 +01:00
Earl Warren b17113bb06
Revert "[GITEA] Ignore temporary files for directory size"
This reverts commit 68dddcc6ff.
2023-12-08 13:40:06 +01:00
Earl Warren 72bbb30f9d Merge pull request '[GITEA] notifies admins on new user registration (squash) fix locale' (#1892) from earl-warren/forgejo:wip-v1.21-notify-admin-new-user into v1.21/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/1892
2023-12-06 18:49:28 +00:00
Aravinth Manivannan bc0078a50a
[GITEA] notifies admins on new user registration (squash) fix locale
(cherry picked from commit 54cd100d8d)
2023-12-06 18:36:17 +01:00
Earl Warren a923dad82d Merge pull request '[FEAT] add Forgejo Git Service (squash) register a Forgejo factory' (#1884) from earl-warren/forgejo:wip-v1.21-forgejo-migration into v1.21/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/1884
2023-12-06 12:02:27 +00:00
Earl Warren 61fc5c514a
[FEAT] add Forgejo Git Service (squash) register a Forgejo factory
If the Forgejo factory for the Forgejo service is not registered,
newDownloader will fallback to a git service and not migrate issues
etc.

Refs: https://codeberg.org/forgejo/forgejo/issues/1678
(cherry picked from commit 2ecb2558be696965a49b543d5e843526c105e07a)

Do not include tests so it is kept minimal.
2023-12-06 12:40:06 +01:00
Gusted 69221d84cf Merge pull request '[GITEA] Make pagination test more robust (squash)' (#1885) from Gusted/forgejo:forgejo-bp-1880 into v1.21/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/1885
2023-12-05 22:50:42 +00:00
Gusted 114f18f105
[GITEA] Make pagination test more robust (squash)
- Backport #1882
- Be more specific of which element we want and also don't include the
href into the selector, so if the value changes, it will show the value
that was rendered.
- Ensure stable order of passed repository IDs.
- Resolves codeberg.org/forgejo/forgejo/issues/1880

(cherry picked from commit 79bc4cffe5)
2023-12-05 18:47:19 +01:00
Gusted 1263d0d416 Merge pull request '[GITEA] Add download URL for executable files' (#1846) from Gusted/forgejo:forgejo-bp-1839 into v1.21/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/1846
2023-12-04 18:35:20 +00:00
Gusted 958a20865b [GITEA] Add download URL for executable files
- Backport https://codeberg.org/forgejo/forgejo/pulls/1839
- Consider executable files as a valid case when returning a downloadURL
for them. They are just regular files with the difference being the
executable permission bit being set.
- Not integration testing as it's not possible without adding adjusting
the existing repositories to have a executable file.
- Resolves https://codeberg.org/forgejo/forgejo/issues/1825

(cherry picked from commit ca32891d54)
2023-12-04 17:19:13 +00:00
Gusted 4de2148ae4 Merge pull request '[GITEA] Only pass selected repository IDs to pagination' (#1865) from Gusted/forgejo:forgejo-bp-1848 into v1.21/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/1865
2023-12-01 22:30:27 +00:00
Gusted 2552bb7b6e [GITEA] Only pass selected repository IDs to pagination
- Backport of https://codeberg.org/forgejo/forgejo/pulls/1848
- `ReposParam` is passed to the pagination as value for the `repos`
query. It should paginate to other pages with only the selected
repositories, which was currently not the case, but was already the case
for the links in the selectable items.
- Fix the wrong value being passed for issues/pulls lists.
- Fix the formatting of repository query value for milestones lists.
- Added integration testing.
- Resolves https://codeberg.org/forgejo/forgejo/issues/1836

(cherry picked from commit c648e5ab3a)
2023-12-01 19:59:21 +00:00
Gusted 272d0a4c20 Merge pull request '[GITEA] Avoid conflicts of issue and PR numbers in GitLab migration (backport)' (#1863) from wetneb/forgejo:backport-1790-sql-error-in-gitlab-migration into v1.21/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/1863
2023-12-01 19:49:47 +00:00
Antonin Delpeuch 55b9aed470 [GITEA] Avoid conflicts of issue and PR numbers in GitLab migration (#1790)
Closes #1789.

The bug was due to the fact that GitLab does not guarantee that issue numbers are created sequentially: some identifiers can be skipped. Therefore, the new pull requests numbers should not be offset by the number of issues, but by the maximum issue number.

See for instance https://gitlab.com/troyengel/archbuild/-/issues/?sort=created_date&state=all&first_page_size=20, where there is only a singe issue with number "2".

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/1790
Co-authored-by: Antonin Delpeuch <antonin@delpeuch.eu>
Co-committed-by: Antonin Delpeuch <antonin@delpeuch.eu>
(cherry picked from commit 2c185c39fe)
2023-12-01 19:17:46 +00:00
Antonin Delpeuch 0afc181d20 [GITEA] Introduce HTTP mocking utility for unit tests (#1858)
Closes #1837.

The differences in dates can be explained by commit e19b9653ea, which
changed the order in which "created_date" and "updated_date" are
considered.
2023-12-01 19:17:46 +00:00
Gergely Nagy 1fea3ce659 [GITEA] new doctor check: fix-push-mirrors-without-git-remote (#1853)
Same as https://codeberg.org/forgejo/forgejo/pulls/1853, backported to v1.21/forgejo

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/1864
Co-authored-by: Gergely Nagy <forgejo@gergo.csillger.hu>
Co-committed-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2023-12-01 13:56:03 +00:00
Gusted 4d54a2b497 Merge pull request '[GITEA] oauth2: use link_account page when email/username is missing (backport)' (#1862) from wetneb/forgejo:backport-1755-oauth2-missing-email into v1.21/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/1862
2023-11-30 21:39:24 +00:00
Antonin Delpeuch e6fb2107f2 [GITEA] oauth2: use link_account page when email/username is missing (#1757)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/1757
Co-authored-by: Antonin Delpeuch <antonin@delpeuch.eu>
Co-committed-by: Antonin Delpeuch <antonin@delpeuch.eu>
(cherry picked from commit 0f6e0f9035)
2023-11-30 15:40:12 +01:00
Gusted 1327ca7178 Merge pull request '[DB] Ensure forgejo migration up to date (squash)' (#1850) from Gusted/forgejo:forgejo-bp-1849 into v1.21/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/1850
2023-11-28 23:04:45 +00:00
Gusted b65e44e464
[DB] Ensure forgejo migration up to date (squash)
- Backport https://codeberg.org/forgejo/forgejo/pulls/1849
- Hook Forgejo's `EnsureUpToDate` to Gitea's `EnsureUpToDate`, such that
the Forgejo migrations are also being checked to be up to date.
- I'm not sure how I missed this and if this has caused any problems,
but due to the lack of any open issue about it it seems to not be a big
problem.

(cherry picked from commit 6c65b6dcf6)
2023-11-28 23:29:02 +01:00
Earl Warren bc59be2fea
[I18N] Add Locale merger script (squash) abort on NOOP
If a string is no longer used in the english version of the locales,
it means the Gitea string was changed and it needs updating. Abort
when it is the case and recommend action.
2023-11-28 17:52:11 +01:00
Loïc Dachary ab7e649668
test GET /{owner}/{repo}/comments/{id}/attachments
(cherry picked from commit 888dda12cf9bc95f9ef85ba5a518cf40152e07ea)
(cherry picked from commit aceeca55da)
2023-11-26 14:12:06 +01:00
Loïc Dachary e140c5c983
test POST /{username}/{reponame}/{type:issues|pulls}/move_pin
(cherry picked from commit 52f50792606a22cbf1e144e1bd480984abf6f53f)
(cherry picked from commit 65b942fa1e)
2023-11-26 14:11:46 +01:00
Loïc Dachary 6483bceee2
fix POST /{username}/{reponame}/{type:issues|pulls}/move_pin
(cherry picked from commit 7eda733ed6a22c08a85fdc90deec0c440427cef7)
(cherry picked from commit 2d9d2979e6)
2023-11-26 14:11:36 +01:00
Loïc Dachary 68da5a9cd8
test POST /{username}/{reponame}/{tags,release}/delete
(cherry picked from commit 78dcbb62fe87abe044034d880c9e8c22b44c2c98)
(cherry picked from commit 6707c08c17)
2023-11-26 14:11:03 +01:00
Loïc Dachary 2a8cb675ca
fix POST /{username}/{reponame}/{type:issues|pulls}/{index}/content-history/soft-delete
(cherry picked from commit a11d82a42729eba02032310f7778a9197f4f8ead)
(cherry picked from commit bebc244156)
2023-11-26 14:09:56 +01:00