Commit graph

17035 commits

Author SHA1 Message Date
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
Lunny Xiao
e619ce8ff5
Change log for 1.21.1 (#28222)
As title.

---------

Co-authored-by: delvh <dev.lh@web.de>
(cherry picked from commit 196100a07a)
2023-11-26 13:56:51 +01:00
Lunny Xiao
f4310d74ee
Fix comment permissions (#28213) (#28216)
backport #28213

This PR will fix some missed checks for private repositories' data on
web routes and API routes.

(cherry picked from commit bc3d8bff73)
2023-11-26 13:56:50 +01:00
Giteabot
29556fafb5
Fix actions when tagging (#28061) (#28218)
Backport #28061 by @lunny

close https://github.com/go-gitea/gitea/issues/28053

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
(cherry picked from commit 7f81110461)
2023-11-26 13:56:50 +01:00
Giteabot
620e428117
Docs: Replace deprecated IS_TLS_ENABLED mailer setting in email setup (#28205) (#28208)
Backport #28205 by @CodeShakingSheep

In the [docs for email
setup](https://docs.gitea.com/administration/email-setup)
`mailer.IS_TLS_ENABLED` is mentioned which was replaced by
`mailer.PROTOCOL` in release 1.18.0 according to
https://blog.gitea.com/release-of-1.18.0/ . This change wasn't reflected
in the docs for email setup. I just replaced the deprecated mailer
setting.

Co-authored-by: CodeShakingSheep <19874562+CodeShakingSheep@users.noreply.github.com>
(cherry picked from commit 5ed0eefc9a)
2023-11-26 13:56:50 +01:00
Earl Warren
e672322ca8
[MODERATION] User blocking (squash) do not use shared fixture
It conflicts with a fixtured added in the commit
Fix comment permissions (#28213) (#28216)
2023-11-26 13:56:00 +01:00
Giteabot
84f8a8292e
Fix some incorrect links in docs (#28191) (#28201)
Backport #28191 by @yp05327

https://gitea.com/gitea/gitea-docusaurus/actions/runs/661/jobs/0#jobstep-9-39
I noticed that there are many warning logs in building docs.
It is causing 404 in docs.gitea.com now, so we need to fix it.
And there are also some other problems in v1.19 which can not be done in
this PR.

Co-authored-by: yp05327 <576951401@qq.com>
(cherry picked from commit 4b89c0f996)
2023-11-25 07:27:39 +01:00
pitpalme
453ff1a57d
Fix delete-orphaned-repos (#28200) (#28202)
Backport #28200

gitea doctor failed at checking and fixing 'delete-orphaned-repos',
because table name 'user' needs quoting to be correctly recognized by at
least PostgreSQL.

fixes #28199

(cherry picked from commit 7cae4dfc00)
2023-11-25 07:27:39 +01:00
Giteabot
a019cbde48
Use full width for PR comparison (#28182) (#28186)
Backport #28182 by @lng2020

Follow-up #22844
close #28142
Before

![ksnip_20231123-183906](https://github.com/go-gitea/gitea/assets/70063547/78428a22-b0a0-45f9-9458-7fd5ec73aa29)
After

![full](https://github.com/go-gitea/gitea/assets/70063547/047242cf-9d6c-4b3a-9f92-54102740c27e)

Co-authored-by: Nanguan Lin <70063547+lng2020@users.noreply.github.com>
(cherry picked from commit 28b8e0b43e)
2023-11-25 07:27:39 +01:00