Fix #20456 At some point during the 1.17 cycle abbreviated refs to issue branches started breaking. This is likely due serious inconsistencies in our management of refs throughout Gitea - which is a bug needing to be addressed in a different PR. (Likely more than one) We should try to use non-abbreviated refs as much as possible. That is where a user has inputted a abbreviated ref we should add refs/heads/ if it is branch etc. I know people keep writing and merging PRs that remove prefixes from stored content but it is just wrong and it keeps causing problems like this. We should only remove the prefix at the time of presentation as the prefix is the only way of knowing umambiguously and permanently if the ref is referring to a branch, tag or commit. We need to make it so that every ref has the appropriate prefix, and probably also need to come up with some definitely unambiguous way of storing SHAs if they're used in a ref field. We must not store potentially ambiguous refs. (Especially tagnames - there is no reason why users cannot create a branch with the same short name as a tag and vice versa and any attempt to prevent this will fail. You can even create a branch and a tag that matches a SHA1 pattern.) To that end in order to fix this bug, when parsing issue templates check the provided Ref, if it does not start with refs/ add the BranchPrefix to it. This allows people to make their templates refer to a tag. Next we need to handle the issue links that are already written. The links here are created with `git.RefURL` Here we see there is a bug introduced in #17551 whereby the provided Ref can be double-escaped so we remove the incorrect external escape. (The escape added in #17551 is in the right place - unfortunately it missed that the calling function was doing the wrong thing.) Then within RefURL we check if the unprefixed ref could actually be a SHA before defaulting that an unprefixed ref is actually a commit - if not it is assumed to be a branch. This will handle most of the problem cases excepting the very unusual cases where someone has deliberately written a branch to look like a SHA1. But please if something is called a `ref` or interpreted as a `ref` make it a full-ref before storing or using it. By all means if something is a `branch` assume the prefix is removed but always add it back in if you are using it as a `ref`. Stop storing abbreviated branch names and tag names as refs. It will keep on causing problems like this. Fix #20456 Signed-off-by: Andrew Thornton <art27@cantab.net> |
||
|---|---|---|
| .gitea | ||
| .github | ||
| assets | ||
| build | ||
| cmd | ||
| contrib | ||
| custom/conf | ||
| docker | ||
| docs | ||
| integrations | ||
| models | ||
| modules | ||
| options | ||
| public | ||
| routers | ||
| services | ||
| snap | ||
| templates | ||
| tools | ||
| web_src | ||
| .air.toml | ||
| .changelog.yml | ||
| .drone.yml | ||
| .editorconfig | ||
| .eslintrc.yaml | ||
| .gitattributes | ||
| .gitignore | ||
| .golangci.yml | ||
| .ignore | ||
| .lgtm | ||
| .npmrc | ||
| .spectral.yaml | ||
| .stylelintrc.yaml | ||
| BSDmakefile | ||
| build.go | ||
| CHANGELOG.md | ||
| CONTRIBUTING.md | ||
| DCO | ||
| Dockerfile | ||
| Dockerfile.rootless | ||
| go.mod | ||
| go.sum | ||
| jest.config.js | ||
| LICENSE | ||
| main.go | ||
| MAINTAINERS | ||
| Makefile | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
| README_ZH.md | ||
| SECURITY.md | ||
| webpack.config.js | ||
Gitea - Git with a cup of tea
Purpose
The goal of this project is to make the easiest, fastest, and most painless way of setting up a self-hosted Git service.
As Gitea is written in Go, it works across all the platforms and architectures that are supported by Go, including Linux, macOS, and Windows on x86, amd64, ARM and PowerPC architectures. You can try it out using the online demo. This project has been forked from Gogs since November of 2016, but a lot has changed.
Building
From the root of the source tree, run:
TAGS="bindata" make build
or if SQLite support is required:
TAGS="bindata sqlite sqlite_unlock_notify" make build
The build target is split into two sub-targets:
make backendwhich requires Go Stable, required version is defined in go.mod.make frontendwhich requires Node.js LTS or greater and Internet connectivity to download npm dependencies.
When building from the official source tarballs which include pre-built frontend files, the frontend target will not be triggered, making it possible to build without Node.js and Internet connectivity.
Parallelism (make -j <num>) is not supported.
More info: https://docs.gitea.io/en-us/install-from-source/
Using
./gitea web
NOTE: If you're interested in using our APIs, we have experimental support with documentation.
Contributing
Expected workflow is: Fork -> Patch -> Push -> Pull Request
NOTES:
- YOU MUST READ THE CONTRIBUTORS GUIDE BEFORE STARTING TO WORK ON A PULL REQUEST.
- If you have found a vulnerability in the project, please write privately to security@gitea.io. Thanks!
Translating
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 to fill it as questions pop up.
https://docs.gitea.io/en-us/translation-guidelines/
Further information
For more information and instructions about how to install Gitea, please look at our documentation. If you have questions that are not covered by the documentation, you can get in contact with us on our Discord server or create a post in the discourse forum.
We maintain a list of Gitea-related projects at gitea/awesome-gitea.
The Hugo-based documentation theme is hosted at gitea/theme.
The official Gitea CLI is developed at gitea/tea.
Authors
Backers
Thank you to all our backers! 🙏 [Become a backer]
Sponsors
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]
FAQ
How do you pronounce Gitea?
Gitea is pronounced /ɡɪ’ti:/ as in "gi-tea" with a hard g.
Why is this not hosted on a Gitea instance?
We're working on it.
License
This project is licensed under the MIT License. See the LICENSE file for the full license text.
Screenshots
Looking for an overview of the interface? Check it out!
![]() |
![]() |
![]() |
|---|---|---|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |











