1
1
mirror of https://github.com/go-gitea/gitea synced 2024-11-01 15:54:25 +00:00
Commit Graph

18509 Commits

Author SHA1 Message Date
wxiaoguang
afa8dd45af
Make git push options accept short name (#32245)
Just like what most CLI parsers do: `--opt` means `opt=true`

Then users could use `-o force-push` as `-o force-push=true`
2024-10-12 05:42:10 +00:00
Bruno Sofiato
900ac62251
Allow code search by filename (#32210)
This is a large and complex PR, so let me explain in detail its changes.

First, I had to create new index mappings for Bleve and ElasticSerach as
the current ones do not support search by filename. This requires Gitea
to recreate the code search indexes (I do not know if this is a breaking
change, but I feel it deserves a heads-up).

I've used [this
approach](https://www.elastic.co/guide/en/elasticsearch/reference/7.17/analysis-pathhierarchy-tokenizer.html)
to model the filename index. It allows us to efficiently search for both
the full path and the name of a file. Bleve, however, does not support
this out-of-box, so I had to code a brand new [token
filter](https://blevesearch.com/docs/Token-Filters/) to generate the
search terms.

I also did an overhaul in the `indexer_test.go` file. It now asserts the
order of the expected results (this is important since matches based on
the name of a file are more relevant than those based on its content).
I've added new test scenarios that deal with searching by filename. They
use a new repo included in the Gitea fixture.

The screenshot below depicts how Gitea shows the search results. It
shows results based on content in the same way as the current version
does. In matches based on the filename, the first seven lines of the
file contents are shown (BTW, this is how GitHub does it).


![image](https://github.com/user-attachments/assets/9d938d86-1a8d-4f89-8644-1921a473e858)

Resolves #32096

---------

Signed-off-by: Bruno Sofiato <bruno.sofiato@gmail.com>
2024-10-11 23:35:04 +00:00
Zettat123
0fe5e2b08c
Allow maintainers to view and edit files of private repos when "Allow maintainers to edit" is enabled (#32215)
Fix #31539
2024-10-11 19:08:19 +00:00
Lunny Xiao
aebb741c08
Use per package global lock for container uploads instead of memory lock (#31860)
This PR uses a per-package lock instead of a global lock for container
uploads. So that different packages can be uploaded simultaneously.
2024-10-11 07:37:49 +00:00
cloudchamb3r
cb739f5333
Fix checkbox bug on private/archive filter (#32236)
fix #32235

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-10-11 01:12:27 +08:00
wxiaoguang
6029d78ab5
Improve the maintainblity of the reserved username list (#32229) 2024-10-10 09:04:42 +00:00
Lunny Xiao
c2217670dd
Move admin routers from /admin to /-/admin (#32189)
Resolve #32181

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-10-10 04:56:49 +00:00
wxiaoguang
dd83cfcacc
Refactor CSRF token (#32216) 2024-10-10 03:48:21 +00:00
GiteaBot
368b0881f5 [skip ci] Updated translations via Crowdin 2024-10-10 00:30:33 +00:00
Zettat123
4eacc61f64
Fix incorrect "Target branch does not exist" in PR title (#32222) 2024-10-10 08:25:46 +08:00
Ehsan Shirvanian
8bee7fcf7e
update git book link to v2 (#32221)
Fix the dead link `https://git-scm.com/book/en/Git-Basics-Getting-a-Git-Repository` for
empty repositories to help how to clone the repository
to `https://git-scm.com/book/en/v2/Git-Basics-Getting-a-Git-Repository` 
which is v2 of the git book. This also updates download git links
2024-10-09 13:04:34 +08:00
GiteaBot
f9a9b08896 [skip ci] Updated translations via Crowdin 2024-10-09 00:31:01 +00:00
cloudchamb3r
2e12343fc4
Add null check for responseData.invalidTopics (#32212)
<img width="553" alt="Screenshot 2024-10-08 at 10 49 10 AM"
src="https://github.com/user-attachments/assets/faeef64d-684a-4aba-b7fc-c7c6a0301abe">

`responseData.invalidTopics` can be null but it wasn't handled.
2024-10-09 01:27:05 +08:00
Lunny Xiao
d6d3c96e65
Fix bug when a token is given public only (#32204) 2024-10-08 12:51:09 +03:00
GiteaBot
d3ada91ea4 [skip ci] Updated translations via Crowdin 2024-10-08 00:30:42 +00:00
6543
bdd655f2bd
Allow filtering PRs by poster in the ListPullRequests API (#32209)
as title

---
*Sponsored by Kithara Software GmbH*
2024-10-07 23:21:07 +02:00
Lunny Xiao
fa35ace9fb
Fix bug when there are multiple triggers with workflow dispatch (#32200) 2024-10-07 03:50:38 +00:00
GiteaBot
6551847aa8 [skip ci] Updated licenses and gitignores 2024-10-07 00:32:39 +00:00
GiteaBot
e530568666 [skip ci] Updated translations via Crowdin 2024-10-06 00:34:29 +00:00
Yarden Shoham
479c31bb4d
Upgrade htmx to 2.0.3 (#32192)
Release notes:
https://github.com/bigskysoftware/htmx/releases/tag/v2.0.3

Tested `Star`, `Watch`, and the admin dashboard page. All functionality
remains unchanged.

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
2024-10-06 04:52:30 +08:00
Zisu Zhang
66923e02d2
Enhance USER_DISABLED_FEATURES to allow disabling change username or full name (#31959)
Fix #31958
Enhanced `USER_DISABLED_FEATURES`(also `EXTERNAL_USER_DISABLE_FEATURES`)
option in `[admin]` section.
Added following values:
- `change_username`: Disable change username
- `change_full_name`: Disable change full name
---

Progress:
- [x] Update code
- [x] Update translations
2024-10-05 20:41:38 +00:00
GiteaBot
6a4eb126bd [skip ci] Updated translations via Crowdin 2024-10-05 00:30:40 +00:00
yp05327
5d6d025c9b
Add support for searching users by email (#30908)
Fix #30898

we have an option `SearchByEmail`, so enable it, then we can search user
by email.
Also added a test for it.
2024-10-04 17:45:06 +00:00
Job
7e68bc8823
Fix PR creation on forked repositories (#31863)
Resolves #20475
2024-10-04 13:12:48 -04:00
GiteaBot
0bd75390f5 [skip ci] Updated translations via Crowdin 2024-10-04 00:30:54 +00:00
Bruno Sofiato
d266d190bd
Fixed race condition when deleting documents by repoId in ElasticSearch (#32185)
Resolves #32184

---------

Signed-off-by: Bruno Sofiato <bruno.sofiato@gmail.com>
2024-10-03 16:03:36 +00:00
sommerf-lf
0b1b4030e6
add {{TEST_MINIO_ENDPOINT}} for local testing "with/without" docker + fix pgsql testing doc (#32105)
while testing i found out that testing locally as documented in the
changed README.md for pgsql isn't working because of the minio
dependency. reworked this to by default be still docker, but allow for
for local with only minio in docker and testing on bare metal.
also depending on this: fixed docs for running pgsql test

Closes: #32168 (by changing documentation for pgsql tests)
Closes: #32169 (by changing documentation, Makefile & pgsql.ini.tmpl:
adding {{TEST_MINIO_ENDPOINT}})

sry for the combined pr, but when testing I ran into this issue and
first thought they were related and now finally address the same
problem: not beeing able to run pgsql integration tests as described in
the according README.md
2024-10-03 01:00:56 +00:00
GiteaBot
4416a4199b [skip ci] Updated translations via Crowdin 2024-10-03 00:30:51 +00:00
Lunny Xiao
a989404e23
Fix javascript error when an anonymous user visiting migration page (#32144)
This PR fixes javascript errors when an anonymous user visits the
migration page.
It also makes task view checking more restrictive.

The router moved from `/user/task/{id}/status` to
`/username/reponame/-/migrate/status` because it's a migrate status.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-10-02 04:37:16 +00:00
Lunny Xiao
3a4a1bffbe
Make oauth2 code clear. Move oauth2 provider code to their own packages/files (#32148)
Fix #30266
Replace #31533
2024-10-02 08:03:19 +08:00
yp05327
70b7df0e5e
Support repo license (#24872)
Close #278
Close #24076

## Solutions:
- Use
[google/licenseclassifier](https://github.com/google/licenseclassifier/)
Test result between
[google/licensecheck](https://github.com/google/licensecheck) and
[go-license-detector](https://github.com/go-enry/go-license-detector):
https://github.com/go-gitea/gitea/pull/24872#issuecomment-1560361167
Test result between
[google/licensecheck](https://github.com/google/licensecheck) and
[google/licenseclassifier](https://github.com/google/licenseclassifier/):
https://github.com/go-gitea/gitea/pull/24872#issuecomment-1576092178
- Generate License Convert Name List to avoid import license templates
with same contents
Gitea automatically get latest license data from[
spdx/license-list-data](https://github.com/spdx/license-list-data).
But unfortunately, some license templates have same contents. #20915
[click here to see the
list](https://github.com/go-gitea/gitea/pull/24872#issuecomment-1584141684)
So we will generate a list of these license templates with same contents
and create a new file to save the result when using `make
generate-license`. (Need to decide the save path)
- Save License info into a new table `repo_license`
Can easily support searching repo by license in the future.

## Screen shot
Single License:

![image](https://github.com/go-gitea/gitea/assets/18380374/41260bd7-0b4c-4038-8592-508706cffa9f)

Multiple Licenses:

![image](https://github.com/go-gitea/gitea/assets/18380374/34ce2f73-7e18-446b-9b96-ecc4fb61bd70)

Triggers:
- [x] Push commit to default branch
- [x] Create repo
- [x] Mirror repo
- [x] When Default Branch is changed, licenses should be updated

Todo:
- [x] Save Licenses info in to DB when there's a change to license file
in the commit
- [x] DB Migration
- [x] A nominal test?
- [x] Select which library to
use(https://github.com/go-gitea/gitea/pull/24872#issuecomment-1560361167)
- [x] API Support
- [x] Add repo license table
- ~Select license in settings if there are several licenses(Not
recommended)~
- License board(later, not in this PR)

![image](https://github.com/go-gitea/gitea/assets/18380374/2c3c3bf8-bcc2-4c6d-8ce0-81d1a9733878)

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Denys Konovalov <kontakt@denyskon.de>
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: 6543 <m.huber@kithara.com>
Co-authored-by: a1012112796 <1012112796@qq.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.com>
2024-10-01 15:25:08 -04:00
Zettat123
f4b8f6fc40
Fix the logic of finding the latest pull review commit ID (#32139)
Fix #31423
2024-10-01 01:58:55 +00:00
Jason Song
13283873e9
Ensure GetCSRF doesn't return an empty token (#32130)
Since page templates keep changing, some pages that contained forms with
CSRF token no longer have them.

It leads to some calls of `GetCSRF` returning an empty string, which
fails the tests. Like

3269b04d61/tests/integration/attachment_test.go (L62-L63)

The test did try to get the CSRF token and provided it, but it was
empty.
2024-09-30 02:28:09 +00:00
Manuel Valls Fernández
5015de4d9a
Bump minio-go to latest version (#32156)
Current minio-go version has issues with S3 compatible storages like
Backblaze or Wasabi. This was fixed in
https://github.com/minio/minio-go/pull/1980 .
2024-09-30 09:57:48 +08:00
Bruno Sofiato
99d0510cb6
Change the code search to sort results by relevance (#32134)
Resolves #32129

Signed-off-by: Bruno Sofiato <bruno.sofiato@gmail.com>
2024-09-28 20:13:55 +00:00
GiteaBot
ad749fbf25 [skip ci] Updated translations via Crowdin 2024-09-28 00:30:56 +00:00
ConcurrentCrab
8a9fd7f771
Add pure SSH LFS support (#31516)
Fixes #17554
/claim #17554

Docs PR https://gitea.com/gitea/docs/pulls/49

To test, run pushes like: `GIT_TRACE=1` git push. The trace output
should mention "pure SSH connection".
2024-09-27 10:27:37 -04:00
GiteaBot
fdb1df9eca [skip ci] Updated translations via Crowdin 2024-09-27 00:31:00 +00:00
Lunny Xiao
3f9e360142
Don't join repository when loading action table data (#32127) 2024-09-26 04:50:30 +00:00
charles
3269b04d61
Notify the user when the file path contains leading or trailing spaces and fix the error message for invalid file names. (#31507)
close #31478
2024-09-24 19:06:52 +00:00
yp05327
6fa962f409
Fix wrong status of Set up Job when first step is skipped (#32120)
Fix #32089
2024-09-24 18:34:08 +00:00
Lunny Xiao
5a8568459d
Fix bug when deleting a migrated branch (#32075)
After migrating a repository with pull request, the branch is missed and
after the pull request merged, the branch cannot be deleted.
2024-09-24 07:42:08 +00:00
Lunny Xiao
4947bec836
Include collaboration repositories on dashboard source/forks/mirrors list (#31946)
Fix #13489

In the original implementation, only `All` will display your owned and
collaborated repositories. For other filters like `Source`, `Mirrors`
and etc. will only display your owned repositories.

This PR removed the limitations. Now except `collbrations`, other
filters will always display your owned and collaborated repositories.
2024-09-24 07:12:06 +00:00
Lunny Xiao
e2f365b55c
Display head branch more comfortable on pull request view (#32000)
This PR do some minor improvements for head branch display on pull
request view UI.

- [x] Remove the link if the head branch has been deleted with a
tooltip, so that users will not result in a 404 page
- [x] Display a label if this pull request is an agit based one.

![图片](https://github.com/user-attachments/assets/872f26b6-f1cf-4427-9e41-e3a5b176dfa4)
2024-09-24 04:14:57 +00:00
Kemal Zebari
aadbe0488f
Truncate commit message during Discord webhook push events (#31970)
Resolves #31668.
2024-09-24 03:38:08 +00:00
Lunny Xiao
2c6fa6c1e0
Fix template bug of pull request view (#32072)
Caused by #31924
2024-09-24 03:02:42 +00:00
Lunny Xiao
6eb5950835
Allow set branch protection in an empty repository (#32095) 2024-09-24 02:06:28 +00:00
Lunny Xiao
3f2d8f8730
Fix panic when cloning with wrong ssh format. (#32076) 2024-09-24 01:30:05 +00:00
Zettat123
fcedf634d5
Fix bug in getting merged pull request by commit (#32079) 2024-09-24 01:00:09 +00:00
GiteaBot
6afb22448b [skip ci] Updated translations via Crowdin 2024-09-24 00:30:57 +00:00