1
1
mirror of https://github.com/go-gitea/gitea synced 2025-01-08 00:44:26 +00:00
Commit Graph

4704 Commits

Author SHA1 Message Date
wxiaoguang
4f386e2c5e
Refactor env var related code (#33075)
And add more comments
2025-01-02 11:36:50 +08:00
JonRB
233b7959e0
unset XDG_HOME_CONFIG as gitea manages configuration locations (#33067)
unset XDG_CONFIG_HOME early to enable gitea to manage git configuration.
simple error checking to satisfy the linting. Closes #33039

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-01-02 06:37:35 +08:00
wxiaoguang
2564c15cb0
Remove some unnecessary template helpers (#33069)
DisableGitHooks and DisableImportLocal are only used when editing a
user, so only set them in `editUserCommon`
2025-01-01 18:02:34 +08:00
Steffen Schröter
57eb9d0b64
Inherit submodules from template repository content (#16237)
Fix #10316

---------

Signed-off-by: Steffen Schröter <steffen@vexar.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-01-01 02:55:13 +00:00
wxiaoguang
a0853e2278
Fix unittest and repo create bug (#33061)
1. `StatDir` was not right, fix the FIXME
2. Clarify the test cases for `IsUsableRepoName`
3. Fix regression bug in `repo-new.ts`

Fix #33060
2024-12-31 18:45:05 +08:00
wxiaoguang
e5c576e92b
Refactor maven package registry (#33049)
Close #33036
2024-12-31 05:30:52 +00:00
Chai-Shi
0387195abb
[Feature] Private README.md for organization (#32872)
Implemented #29503

---------

Co-authored-by: Ben Chang <ben_chang@htc.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-12-31 04:22:09 +00:00
cassio zareck
1e2c8eb494
Fix settings not being loaded at CLI (#26402)
Closes #25898
The problem was that the default settings weren't being loaded

---------

Signed-off-by: cassiozareck <cassiomilczareck@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-12-30 05:54:20 +00:00
wxiaoguang
dafadf0028
Refactor fixture loading for testing (#33024)
To help binary size and testing performance
2024-12-30 04:06:57 +00:00
Lunny Xiao
f4ccbd38dc
Use gitrepo.GetTreePathLatestCommit to get file lastest commit instead from latest commit cache (#32987)
The latest commit cache is currently used only for listing tree files.
However, a cold start may take longer than directly invoking the Git
command. This PR addresses the issue of slow response times when
accessing raw files, improving performance in such scenarios.

```log
gitea.log:105521:2024/12/23 08:22:18 ...eb/routing/logger.go:68:func1() [W] router: slow      GET /xxxx/xxxxxx/raw/commit/xxxxxxxxxxxxxxxxxxxxxxxxxxx/.editorconfig for 172.18.0.5:53252, elapsed 3526.8ms @ repo/download.go:117(repo.SingleDownload)
```
2024-12-30 03:30:01 +00:00
wxiaoguang
e435b1900a
Refactor arch route handlers (#32993) 2024-12-28 03:31:46 +00:00
yp05327
7bb7ba1b5b
Add show more organizations icon in user's profile (#32986)
Close #32952

# ⚠️ Doc update is required


![image](https://github.com/user-attachments/assets/296c5109-8fc1-43ea-b7dc-e79919cc1f9a)

![image](https://github.com/user-attachments/assets/d30980f6-22e4-4b97-9143-c750dc399da6)


------
⚠️This PR refuses to be cherry-picked by any forked projects without any
mentions.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-12-27 02:49:50 +08:00
wxiaoguang
550abdbc24
Improve "ellipsis string" (#32989) 2024-12-26 14:19:35 +08:00
wxiaoguang
9bfa9f450d
Refactor "string truncate" (#32984) 2024-12-26 11:56:03 +08:00
wxiaoguang
594edad213
Do not render truncated links in markdown (#32980)
Fixes #31780
2024-12-26 00:33:55 +08:00
Zettat123
abaeae0b9c
Fix Azure blob object Seek (#32974)
This bug was found in a
[test](https://github.com/go-gitea/gitea/actions/runs/12464294025/job/34788152194?pr=32883#step:9:105)
of #32883

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-12-25 04:54:52 +00:00
wxiaoguang
973363fec3
Fix maven pom inheritance (#32943)
Fix  #30568
2024-12-25 04:28:37 +00:00
wxiaoguang
ca31d478ee
Refactor arch route handlers (#32972) 2024-12-25 04:03:14 +00:00
wxiaoguang
2a828e2798
Clarify path param naming (#32969)
In history (from some legacy frameworks), both `:name` and `name` are
supported as path path name, `:name` is an alias to `name`.

To make code consistent, now we should only use `name` but not `:name`.

Also added panic check in related functions to make sure the name won't
be abused in case some downstreams still use them.
2024-12-24 13:47:45 +00:00
Lunny Xiao
b8b690feb9
Refactor getpatch/getdiff functions and remove unnecessary fallback (#32817)
Extract from #32786 

`git diff a..b` is equal to `git diff a b` which is different from `git
diff a...b`. For pull request, we should always 

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-12-24 14:29:34 +08:00
wxiaoguang
6d5aa9218e
Refactor request context (#32956)
Introduce RequestContext: is a short-lived context that is used to store
request-specific data.

RequestContext could be used to clean form tmp files, close context git
repo, and do some tracing in the future.

Then a lot of legacy code could be removed or improved. For example:
most `ctx.Repo.GitRepo.Close()` could be removed because the git repo
could be closed when the request is done.
2024-12-24 11:43:57 +08:00
wxiaoguang
781c6df40f
Add sub issue list support (#32940)
Just like GitHub, show issue icon/title when the issue number is in a list
2024-12-24 01:54:19 +00:00
wxiaoguang
bd5d1341d4
Fix commit range paging (#32944) 2024-12-23 07:07:12 +00:00
wxiaoguang
462ce31530
Fix repo avatar conflict (#32958)
Continue even if the avatar deleting fails
2024-12-23 02:52:25 +00:00
katsu
fb75151fb1
fix trailing comma not matched in the case of alphanumeric issue (#32945)
Fix #32428.

Patch the regex to match `,`besides `.` `"` `'` `:` and space.
2024-12-22 21:32:28 +00:00
wxiaoguang
a163c53a60
Refactor template & test related code (#32938)
Move some legacy code from "base" package to proper packages.
2024-12-22 15:33:19 +00:00
Aindriú Mac Giolla Eoin
23687a0a71
Update i18n.go - Language Picker (#32933) 2024-12-21 04:56:08 +00:00
Lunny Xiao
751fe8b714
Move some errors to their own sub packages (#32880) 2024-12-20 18:05:29 +00:00
wxiaoguang
52b319bc00
Refactor pprof labels and process desc (#32909)
* Deprecate "gopid" in log, it is not useful and requires very hacky
approach
* Remove "git.Command.SetDescription" because it is not useful and only
makes the logs too flexible
2024-12-20 12:17:14 +08:00
silverwind
626b27bea5
Update go tool dependencies (#32916)
Update all go tool dependencies to latest version. WIP because I think
there are new gopls errors, would like to confirm them on CI first. Here
is from a local run:

```
modules/markup/markdown/goldmark.go:115:37-53: unnecessary type arguments
modules/markup/html.go:45:32-49: unnecessary type arguments
modules/markup/internal/renderinternal.go:20:33-49: unnecessary type arguments
modules/markup/common/linkify.go:27:32-49: unnecessary type arguments
modules/util/time_str.go:28:39-63: unnecessary type arguments
routers/web/repo/pull.go:704:19: impossible condition: non-nil == nil
modules/util/util_test.go:248:14-23: unused parameter: other
```

~~Backport because the `gxz` update might have security benefits.~~
2024-12-19 19:17:55 +01:00
Exploding Dragon
581e52b3e7
Relax the version checking for Arch packages (#32908)
It is mentioned in https://man.archlinux.org/man/PKGBUILD.5: 'The
variable is not allowed to contain colons, forward slashes, hyphens, or
whitespace.'

`_` is also an allowed character, and some software in the Arch Linux
AUR uses this naming convention.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-12-19 09:41:23 +00:00
Exploding Dragon
2beaedc417
Fix Arch package metadata introduced incorrect field (#32881)
Incorrect content was introduced while generating the index, which has
now been removed, and the missing fields have been added.

![](https://github.com/user-attachments/assets/4fbb8884-337e-43b1-939f-a5ba687f7ffd)
2024-12-18 15:25:05 +08:00
TheFox0x7
b945742293
Change pprof labels to be prometheus compatible (#32865)
Enables scrapping pprof endpoint for continuous profiling

Closes: https://github.com/go-gitea/gitea/issues/32854
2024-12-18 11:08:04 +08:00
wxiaoguang
2d7e6e9482
Fix various trivial problems (#32861)
1. add/improve comments to help future readers could understand the
problem more easily.
2. add an error log to LDAP with username fallback
3. use `or` instead of `Iif` for "repo/branch_dropdown" (`Iif` was a
mistake, but it doesn't really affect the UI)
4. add `tw-font-mono` style to container digest to match dockerhub
5. fix a bug in RepoBranchTagSelector: the form is not updated when
there is no click to an item

---------

Co-authored-by: delvh <dev.lh@web.de>
2024-12-17 01:15:18 +00:00
hiifong
276f43330c
Do not display attestation-manifest and use short sha256 instead of full sha256 (#32851)
Related: #24973

Before:

![image](https://github.com/user-attachments/assets/bca17900-5075-4d15-af7a-c71bf8979c04)

After:

![image](https://github.com/user-attachments/assets/c5a24e3b-763b-4463-80db-d4dbd89f7dc4)

Index:
```json
{
  "schemaVersion": 2,
  "mediaType": "application/vnd.oci.image.index.v1+json",
  "manifests": [
    {
      "mediaType": "application/vnd.oci.image.manifest.v1+json",
      "digest": "sha256:5967afffdfde104ca1459286a72346baaef8b70ac153325d7a6cd85c7734ac6e",
      "size": 672,
      "platform": {
        "architecture": "amd64",
        "os": "linux"
      }
    },
    {
      "mediaType": "application/vnd.oci.image.manifest.v1+json",
      "digest": "sha256:f9abfcc55320f9ff1f38eeb7dbb4bea10b29c7febfa49ccd7aab9fa02403b9f0",
      "size": 672,
      "platform": {
        "architecture": "arm64",
        "os": "linux"
      }
    },
    {
      "mediaType": "application/vnd.oci.image.manifest.v1+json",
      "digest": "sha256:d70ad19d00c19e40691045cbddc3e8a5a4454c31cc454d1132b13bcaf35b6d46",
      "size": 566,
      "annotations": {
        "vnd.docker.reference.digest": "sha256:5967afffdfde104ca1459286a72346baaef8b70ac153325d7a6cd85c7734ac6e",
        "vnd.docker.reference.type": "attestation-manifest"
      },
      "platform": {
        "architecture": "unknown",
        "os": "unknown"
      }
    },
    {
      "mediaType": "application/vnd.oci.image.manifest.v1+json",
      "digest": "sha256:73bc233bf4eac96a404ce3e0430b698831a4ea7050c878d5f76d1d1f133751dd",
      "size": 566,
      "annotations": {
        "vnd.docker.reference.digest": "sha256:f9abfcc55320f9ff1f38eeb7dbb4bea10b29c7febfa49ccd7aab9fa02403b9f0",
        "vnd.docker.reference.type": "attestation-manifest"
      },
      "platform": {
        "architecture": "unknown",
        "os": "unknown"
      }
    }
  ]
}
```

---------

Co-authored-by: silverwind <me@silverwind.io>
2024-12-16 10:22:49 +08:00
TheFox0x7
33e8e82c4b
Enable tenv and testifylint rules (#32852)
Enables tenv and testifylint linters
closes: https://github.com/go-gitea/gitea/issues/32842
2024-12-15 10:41:29 +00:00
wxiaoguang
d1c1e3cbcc
Fine tune ssh related comments and code (#32846)
Add more comments to explain the ssh problem, 
and rename `sshConn` to `sshSession`
2024-12-15 06:07:50 +00:00
silverwind
1cfb718976
Update golangci-lint to v1.62.2, fix issues (#32845)
Update it and fix new issues related to `redefines-builtin-id`
2024-12-15 02:31:07 +00:00
hiifong
7616aeb2ea
In some lfs server implementations, they require the ref attribute. (#32838)
Fix: #32611

In some lfs server implementations, they require the ref attribute.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-12-15 02:06:21 +00:00
wxiaoguang
cc5ff98e0d
Refactor markdown math render (#32831)
Add more tests
2024-12-14 13:43:05 +08:00
hiifong
82c59d52ea
Add User-Agent for gitea's self-implemented lfs client. (#32832) 2024-12-14 03:35:19 +00:00
wxiaoguang
a66c16dc1b
Allow to fork repository into the same owner (#32819)
This feature is experimental, not fully tested, and may be changed in
the future.

It is only designed for users who really need it: set
`[repository].ALLOW_FORK_INTO_SAME_OWNER=true` in your app.ini

Doc: https://gitea.com/gitea/docs/pulls/122


![image](https://github.com/user-attachments/assets/38d08c23-9cfc-49d8-9321-ff81edf65395)
2024-12-14 09:39:05 +08:00
wxiaoguang
5bc030efa2
Fix various UI bugs (#32821) 2024-12-13 01:45:32 -05:00
wxiaoguang
2910f384d5
Fix misuse of PublicKeyCallback (#32810)
Only upgrading the ssh package is not enough.
2024-12-13 03:57:37 +00:00
hiifong
0b8a8941a0
Fix lfs migration (#32812)
Fix: #32803
2024-12-12 21:36:39 +00:00
wxiaoguang
22bf2ca6ba
Make API "compare" accept commit IDs (#32801) 2024-12-12 08:10:09 +00:00
Kemal Zebari
01b1896bf5
Implement update branch API (#32433)
Resolves #22526.

Builds upon #23061.

---------

Co-authored-by: sillyguodong <33891828+sillyguodong@users.noreply.github.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-12-12 05:02:35 +00:00
yp05327
d43620e7bc
Add is_archived option for issue indexer (#32735)
Try to fix #32697

Reason:
`is_archived` is already defined in the query options, but it is not
implemented in the indexer.
2024-12-12 07:33:31 +08:00
wxiaoguang
e619384098
Add label/author/assignee filters to the user/org home issue list (#32779)
Replace #26661, fix #25979

Not perfect, but usable and much better than before. Since it is quite
complex, I am not quite sure whether there would be any regression, if
any, I will fix in first time.

I have tested the related pages many times: issue list, milestone issue
list, project view, user issue list, org issue list.
2024-12-11 06:33:24 +00:00
Lunny Xiao
fbe6d9dc6b
Use batch database operations instead of one by one to optimze api pulls (#32680)
Resolve #31492

The response time for the Pull Requests API has improved significantly,
dropping from over `2000ms` to about `350ms` on my local machine. It's
about `6` times faster.

A key area for further optimization lies in batch-fetching data for
`apiPullRequest.ChangedFiles, apiPullRequest.Additions, and
apiPullRequest.Deletions`.

Tests `TestAPIViewPulls` does exist and new tests added.

- This PR also fixes some bugs in `GetDiff` functions.
- This PR also fixes data inconsistent in test data. For a pull request,
the head branch's reference should be equal to the reference in
`pull/xxx/head`.
2024-12-11 05:15:06 +08:00