Skip to content

Commit 099187d

Browse files
committed
Merge remote-tracking branch 'upstream/main'
* upstream/main: Fix commit status icon when in subdirectory (go-gitea#20285) Fix eslint parsing errors, remove eslint-plugin-html (go-gitea#20323) Include login_name in adminCreateUser response (go-gitea#20283) Add allow_rebase_update, default_delete_branch_after_merge to repository api response (go-gitea#20079) Allow to specify colors for text in markup (go-gitea#20363) [skip ci] Updated translations via Crowdin update xorm.io/xorm v1.3.2-0.20220714055524-c3bce556200f (go-gitea#20371) Add order by for assignee no sort issue (go-gitea#20053) Make sure `repo_dir` is an empty directory or doesn't exist before 'dump-repo' (go-gitea#20205) Fix English mistakes in some Markdown documents (go-gitea#20274) Fix versions check for busybox `sh` (go-gitea#20358)
2 parents 6f37063 + 7d20c83 commit 099187d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+240
-234
lines changed

.eslintrc.yaml

+1-18
Original file line numberDiff line numberDiff line change
@@ -11,32 +11,20 @@ parserOptions:
1111
plugins:
1212
- eslint-plugin-unicorn
1313
- eslint-plugin-import
14-
- eslint-plugin-vue
15-
- eslint-plugin-html
1614
- eslint-plugin-jquery
1715

18-
extends:
19-
- plugin:vue/recommended
20-
2116
env:
2217
es2022: true
2318
node: true
2419

2520
globals:
2621
__webpack_public_path__: true
2722

28-
settings:
29-
html/html-extensions: [".tmpl"]
30-
3123
overrides:
32-
- files: ["web_src/**/*.js", "web_src/**/*.vue", "templates/**/*.tmpl"]
24+
- files: ["web_src/**/*.js", "docs/**/*.js"]
3325
env:
3426
browser: true
3527
node: false
36-
- files: ["templates/**/*.tmpl"]
37-
rules:
38-
no-tabs: [0]
39-
indent: [2, tab, {SwitchCase: 1}]
4028
- files: ["web_src/**/*worker.js"]
4129
env:
4230
worker: true
@@ -502,11 +490,6 @@ rules:
502490
use-isnan: [2]
503491
valid-typeof: [2, {requireStringLiterals: true}]
504492
vars-on-top: [0]
505-
vue/attributes-order: [0]
506-
vue/component-definition-name-casing: [0]
507-
vue/html-closing-bracket-spacing: [0]
508-
vue/max-attributes-per-line: [0]
509-
vue/one-component-per-file: [0]
510493
wrap-iife: [2, inside]
511494
wrap-regex: [0]
512495
yield-star-spacing: [2, after]

Makefile

+4-4
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,9 @@ help:
201201

202202
.PHONY: go-check
203203
go-check:
204-
$(eval MIN_GO_VERSION_STR := $(shell grep -Eo '^go\s+[0-9]+\.[0-9.]+' go.mod | cut -d' ' -f2))
205-
$(eval MIN_GO_VERSION := $(shell printf "%03d%03d%03d" $(shell echo '$(MIN_GO_VERSION_STR)' | tr '.' ' ')))
206-
$(eval GO_VERSION := $(shell printf "%03d%03d%03d" $(shell $(GO) version | grep -Eo '[0-9]+\.[0-9.]+' | tr '.' ' ');))
204+
$(eval MIN_GO_VERSION_STR := $(shell grep -Eo '^go\s+[0-9]+\.[0-9]+' go.mod | cut -d' ' -f2))
205+
$(eval MIN_GO_VERSION := $(shell printf "%03d%03d" $(shell echo '$(MIN_GO_VERSION_STR)' | tr '.' ' ')))
206+
$(eval GO_VERSION := $(shell printf "%03d%03d" $(shell $(GO) version | grep -Eo '[0-9]+\.[0-9]+' | tr '.' ' ');))
207207
@if [ "$(GO_VERSION)" -lt "$(MIN_GO_VERSION)" ]; then \
208208
echo "Gitea requires Go $(MIN_GO_VERSION_STR) or greater to build. You can get it at https://go.dev/dl/"; \
209209
exit 1; \
@@ -310,7 +310,7 @@ lint: lint-frontend lint-backend
310310

311311
.PHONY: lint-frontend
312312
lint-frontend: node_modules
313-
npx eslint --color --max-warnings=0 web_src/js build templates *.config.js docs/assets/js
313+
npx eslint --color --max-warnings=0 --ext js,vue web_src/js build *.config.js docs/assets/js
314314
npx stylelint --color --max-warnings=0 web_src/less
315315
npx spectral lint -q -F hint $(SWAGGER_SPEC)
316316

README.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,21 @@
4545
</p>
4646

4747
<p align="center">
48-
<a href="README_ZH.md">View the chinese version of this document</a>
48+
<a href="README_ZH.md">View this document in Chinese</a>
4949
</p>
5050

5151
## Purpose
5252

5353
The goal of this project is to make the easiest, fastest, and most
5454
painless way of setting up a self-hosted Git service.
55-
Using Go, this can be done with an independent binary distribution across
56-
**all platforms** which Go supports, including Linux, macOS, and Windows
57-
on x86, amd64, ARM and PowerPC architectures.
58-
Want to try it before doing anything else?
59-
Do it [with the online demo](https://try.gitea.io/)!
55+
56+
As Gitea is written in Go, it works across **all** the platforms and
57+
architectures that are supported by Go, including Linux, macOS, and
58+
Windows on x86, amd64, ARM and PowerPC architectures.
59+
You can try it out using [the online demo](https://try.gitea.io/).
6060
This project has been
6161
[forked](https://blog.gitea.io/2016/12/welcome-to-gitea/) from
62-
[Gogs](https://gogs.io) since 2016.11 but changed a lot.
62+
[Gogs](https://gogs.io) since November of 2016, but a lot has changed.
6363

6464
## Building
6565

@@ -114,7 +114,7 @@ For more information and instructions about how to install Gitea, please look at
114114
If you have questions that are not covered by the documentation, you can get in contact with us on our [Discord server](https://discord.gg/Gitea) or create a post in the [discourse forum](https://discourse.gitea.io/).
115115

116116
We maintain a list of Gitea-related projects at [gitea/awesome-gitea](https://gitea.com/gitea/awesome-gitea).
117-
The hugo-based documentation theme is hosted at [gitea/theme](https://gitea.com/gitea/theme).
117+
The Hugo-based documentation theme is hosted at [gitea/theme](https://gitea.com/gitea/theme).
118118
The official Gitea CLI is developed at [gitea/tea](https://gitea.com/gitea/tea).
119119

120120
## Authors

README_ZH.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
</p>
4646

4747
<p align="center">
48-
<a href="README.md">View the english version of this document</a>
48+
<a href="README.md">View this document in English</a>
4949
</p>
5050

5151
## 目标

cmd/dump_repo.go

+18-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ package cmd
77
import (
88
"context"
99
"errors"
10+
"fmt"
11+
"os"
1012
"strings"
1113

1214
"code.gitea.io/gitea/modules/convert"
@@ -15,6 +17,7 @@ import (
1517
base "code.gitea.io/gitea/modules/migration"
1618
"code.gitea.io/gitea/modules/setting"
1719
"code.gitea.io/gitea/modules/structs"
20+
"code.gitea.io/gitea/modules/util"
1821
"code.gitea.io/gitea/services/migrations"
1922

2023
"github.com/urfave/cli"
@@ -159,9 +162,23 @@ func runDumpRepository(ctx *cli.Context) error {
159162
}
160163
}
161164

165+
// the repo_dir will be removed if error occurs in DumpRepository
166+
// make sure the directory doesn't exist or is empty, prevent from deleting user files
167+
repoDir := ctx.String("repo_dir")
168+
if exists, err := util.IsExist(repoDir); err != nil {
169+
return fmt.Errorf("unable to stat repo_dir %q: %v", repoDir, err)
170+
} else if exists {
171+
if isDir, _ := util.IsDir(repoDir); !isDir {
172+
return fmt.Errorf("repo_dir %q already exists but it's not a directory", repoDir)
173+
}
174+
if dir, _ := os.ReadDir(repoDir); len(dir) > 0 {
175+
return fmt.Errorf("repo_dir %q is not empty", repoDir)
176+
}
177+
}
178+
162179
if err := migrations.DumpRepository(
163180
context.Background(),
164-
ctx.String("repo_dir"),
181+
repoDir,
165182
ctx.String("owner_name"),
166183
opts,
167184
); err != nil {

docs/content/doc/installation/from-binary.en-us.md

+38-28
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ embedded assets. This can be different for older releases.
2424

2525
## Download
2626

27-
Choose the file matching the destination platform from the [downloads page](https://dl.gitea.io/gitea/), copy the URL and replace the URL within the commands below:
27+
Choose the file matching your platform from the [downloads page](https://dl.gitea.io/gitea/), copy the URL and replace the URL within the commands below:
2828

2929
```sh
3030
wget -O gitea https://dl.gitea.io/gitea/{{< version >}}/gitea-{{< version >}}-linux-amd64
@@ -56,7 +56,8 @@ Check that Git is installed on the server. If it is not, install it first. Gitea
5656
git --version
5757
```
5858

59-
Create user to run Gitea (ex. `git`)
59+
Create a user to run Gitea (e.g. `git`)
60+
6061
```sh
6162
adduser \
6263
--system \
@@ -79,62 +80,71 @@ chown root:git /etc/gitea
7980
chmod 770 /etc/gitea
8081
```
8182

82-
**NOTE:** `/etc/gitea` is temporary set with write rights for user `git` so that Web installer could write configuration file. After installation is done, it is recommended to set rights to read-only using:
83-
```
83+
**NOTE:** `/etc/gitea` is temporarily set with write permissions for user `git` so that the web installer can write the configuration file. After the installation is finished, it is recommended to set permissions to read-only using:
84+
85+
```sh
8486
chmod 750 /etc/gitea
8587
chmod 640 /etc/gitea/app.ini
8688
```
87-
If you don't want the web installer to be able to write the config file at all, it is also possible to make the config file read-only for the Gitea user (owner/group `root:git`, mode `0640`), and set `INSTALL_LOCK = true`. In that case all database configuration details must be set beforehand in the config file, as well as the `SECRET_KEY` and `INTERNAL_TOKEN` values. See the [command line documentation]({{< relref "doc/usage/command-line.en-us.md" >}}) for information on using `gitea generate secret INTERNAL_TOKEN`.
89+
90+
If you don't want the web installer to be able to write to the config file, it is possible to make the config file read-only for the Gitea user (owner/group `root:git`, mode `0640`) however you will need to edit your config file manually to:
91+
92+
* Set `INSTALL_LOCK= true`,
93+
* Ensure all database configuration details are set correctly
94+
* Ensure that the `SECRET_KEY` and `INTERNAL_TOKEN` values are set. (You may want to use the `gitea generate secret` to generate these secret keys.)
95+
* Ensure that any other secret keys you need are set.
96+
97+
See the [command line documentation]({{< relref "doc/usage/command-line.en-us.md" >}}) for information on using `gitea generate secret`.
8898

8999
### Configure Gitea's working directory
90100

91-
**NOTE:** If you plan on running Gitea as a Linux service, you can skip this step as the service file allows you to set `WorkingDirectory`. Otherwise, consider setting this environment variable (semi-)permanently so that Gitea consistently uses the correct working directory.
92-
```
101+
**NOTE:** If you plan on running Gitea as a Linux service, you can skip this step, as the service file allows you to set `WorkingDirectory`. Otherwise, consider setting this environment variable (semi-)permanently so that Gitea consistently uses the correct working directory.
102+
103+
```sh
93104
export GITEA_WORK_DIR=/var/lib/gitea/
94105
```
95106

96-
### Copy Gitea binary to global location
107+
### Copy the Gitea binary to a global location
97108

98-
```
109+
```sh
99110
cp gitea /usr/local/bin/gitea
100111
```
101112

102113
## Running Gitea
103114

104-
After the above steps, two options to run Gitea are:
115+
After you complete the above steps, you can run Gitea two ways:
105116

106117
### 1. Creating a service file to start Gitea automatically (recommended)
107118

108119
See how to create [Linux service]({{< relref "run-as-service-in-ubuntu.en-us.md" >}})
109120

110121
### 2. Running from command-line/terminal
111122

112-
```
123+
```sh
113124
GITEA_WORK_DIR=/var/lib/gitea/ /usr/local/bin/gitea web -c /etc/gitea/app.ini
114125
```
115126

116127
## Updating to a new version
117128

118129
You can update to a new version of Gitea by stopping Gitea, replacing the binary at `/usr/local/bin/gitea` and restarting the instance.
119-
The binary file name should not be changed during the update to avoid problems
120-
in existing repositories.
130+
The binary file name should not be changed during the update to avoid problems in existing repositories.
121131

122-
It is recommended you do a [backup]({{< relref "doc/usage/backup-and-restore.en-us.md" >}}) before updating your installation.
132+
It is recommended that you make a [backup]({{< relref "doc/usage/backup-and-restore.en-us.md" >}}) before updating your installation.
123133

124134
If you have carried out the installation steps as described above, the binary should
125135
have the generic name `gitea`. Do not change this, i.e. to include the version number.
126136

127137
### 1. Restarting Gitea with systemd (recommended)
128138

129-
As explained before, we recommend to use systemd as service manager. In this case ```systemctl restart gitea``` should be enough.
139+
As we explained before, we recommend to use systemd as the service manager. In this case, `systemctl restart gitea` should be fine.
130140

131141
### 2. Restarting Gitea without systemd
132142

133-
To restart your Gitea instance, we recommend to use SIGHUP signal. If you know your Gitea PID use ```kill -1 $GITEA_PID``` otherwise you can use ```killall -1 gitea``` or ```pkill -1 gitea```
143+
To restart your Gitea instance, we recommend to use SIGHUP signal. If you know your Gitea PID, use `kill -1 $GITEA_PID`, otherwise you can use `killall -1 gitea`.
134144

135-
To gracefully stop the Gitea instance, a simple ```kill $GITEA_PID``` or ```killall gitea``` is enough.
145+
To gracefully stop the Gitea instance, a simple `kill $GITEA_PID` or `killall gitea` is enough.
136146

137-
**NOTE:** We don't recommend to use SIGKILL signal (know also as `-9`), you may be forcefully stopping some of Gitea internal tasks and it will not gracefully stop (tasks in queues, indexers processes, etc.)
147+
**NOTE:** We don't recommend to use the SIGKILL signal (`-9`); you may be forcefully stopping some of Gitea's internal tasks, and it will not gracefully stop (tasks in queues, indexers, etc.)
138148

139149
See below for troubleshooting instructions to repair broken repositories after
140150
an update of your Gitea version.
@@ -144,31 +154,31 @@ an update of your Gitea version.
144154
### Old glibc versions
145155

146156
Older Linux distributions (such as Debian 7 and CentOS 6) may not be able to load the
147-
Gitea binary, usually producing an error such as ```./gitea: /lib/x86_64-linux-gnu/libc.so.6:
148-
version `GLIBC\_2.14' not found (required by ./gitea)```. This is due to the integrated
157+
Gitea binary, usually producing an error such as `./gitea: /lib/x86_64-linux-gnu/libc.so.6:
158+
version 'GLIBC\_2.14' not found (required by ./gitea)`. This is due to the integrated
149159
SQLite support in the binaries provided by dl.gitea.io. In this situation, it is usually
150-
possible to [install from source]({{< relref "from-source.en-us.md" >}}) without SQLite
151-
support.
160+
possible to [install from source]({{< relref "from-source.en-us.md" >}}), without including
161+
SQLite support.
152162

153163
### Running Gitea on another port
154164

155165
For errors like `702 runWeb()] [E] Failed to start server: listen tcp 0.0.0.0:3000:
156-
bind: address already in use` Gitea needs to be started on another free port. This
166+
bind: address already in use`, Gitea needs to be started on another free port. This
157167
is possible using `./gitea web -p $PORT`. It's possible another instance of Gitea
158168
is already running.
159169

160170
### Running Gitea on Raspbian
161171

162-
As of v1.8, there is a problem with the arm7 version of Gitea and it doesn't run on Raspberry Pi and similar devices.
172+
As of v1.8, there is a problem with the arm7 version of Gitea, and it doesn't run on Raspberry Pis and similar devices.
163173

164-
It is therefore recommended to switch to the arm6 version which has been tested and shown to work on Raspberry Pi and similar devices.
174+
It is recommended to switch to the arm6 version, which has been tested and shown to work on Raspberry Pis and similar devices.
165175

166176
<!---
167177
please remove after fixing the arm7 bug
168178
--->
169179
### Git error after updating to a new version of Gitea
170180

171-
If the binary file name has been changed during the update to a new version of Gitea,
181+
If during the update, the binary file name has been changed to a new version of Gitea,
172182
Git Hooks in existing repositories will not work any more. In that case, a Git
173183
error will be displayed when pushing to the repository.
174184

@@ -181,9 +191,9 @@ binary.
181191

182192
To solve this, go to the admin options and run the task `Resynchronize pre-receive,
183193
update and post-receive hooks of all repositories` to update all hooks to contain
184-
the new binary path. Please note that this overwrite all Git Hooks including ones
194+
the new binary path. Please note that this overwrites all Git Hooks, including ones
185195
with customizations made.
186196

187-
If you aren't using the built-in to Gitea SSH server you will also need to re-write
197+
If you aren't using the Gitea built-in SSH server, you will also need to re-write
188198
the authorized key file by running the `Update the '.ssh/authorized_keys' file with
189199
Gitea SSH keys.` task in the admin options.

docs/content/page/index.en-us.md

+8-5
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,12 @@ blog post to read about the justification for a fork.
1717
## Purpose
1818

1919
The goal of this project is to provide the easiest, fastest, and most painless way of setting
20-
up a self-hosted Git service. With Go, this can be done with an independent binary distribution
21-
across all platforms and architectures that Go supports. This support includes Linux, macOS, and
22-
Windows, on architectures like amd64, i386, ARM, PowerPC, and others.
20+
up a self-hosted Git service.
21+
22+
With Go, this can be done platform-independently across
23+
**all platforms** which Go supports, including Linux, macOS, and Windows,
24+
on x86, amd64, ARM and PowerPC architectures.
25+
You can try it out using [the online demo](https://try.gitea.io/).
2326

2427
## Features
2528

@@ -268,8 +271,8 @@ Windows, on architectures like amd64, i386, ARM, PowerPC, and others.
268271
- Gitea should be run with a dedicated non-root system account on UNIX-type systems.
269272
- Note: Gitea manages the `~/.ssh/authorized_keys` file. Running Gitea as a regular user could break that user's ability to log in.
270273
- [Git](https://git-scm.com/) version 2.0.0 or later is required.
271-
- [Git Large File Storage](https://git-lfs.github.com/) will be available if enabled when Git >= 2.1.2.
272-
- Git commit-graph rendering will be enabled automatically when Git >= 2.18.
274+
- [Git Large File Storage](https://git-lfs.github.com/) will be available if enabled and if your Git version is >= 2.1.2
275+
- Git commit-graph rendering will be enabled automatically if your Git version is >= 2.18
273276

274277
## Browser Support
275278

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ require (
104104
mvdan.cc/xurls/v2 v2.4.0
105105
strk.kbt.io/projects/go/libravatar v0.0.0-20191008002943-06d1c002b251
106106
xorm.io/builder v0.3.11
107-
xorm.io/xorm v1.3.1
107+
xorm.io/xorm v1.3.2-0.20220714055524-c3bce556200f
108108
)
109109

110110
require (

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -2423,5 +2423,5 @@ strk.kbt.io/projects/go/libravatar v0.0.0-20191008002943-06d1c002b251/go.mod h1:
24232423
xorm.io/builder v0.3.11-0.20220531020008-1bd24a7dc978/go.mod h1:aUW0S9eb9VCaPohFCH3j7czOx1PMW3i1HrSzbLYGBSE=
24242424
xorm.io/builder v0.3.11 h1:naLkJitGyYW7ZZdncsh/JW+HF4HshmvTHTyUyPwJS00=
24252425
xorm.io/builder v0.3.11/go.mod h1:aUW0S9eb9VCaPohFCH3j7czOx1PMW3i1HrSzbLYGBSE=
2426-
xorm.io/xorm v1.3.1 h1:z5egKrDoOLqZFhMjcGF4FBHiTmE5/feQoHclfhNidfM=
2427-
xorm.io/xorm v1.3.1/go.mod h1:9NbjqdnjX6eyjRRhh01GHm64r6N9shTb/8Ak3YRt8Nw=
2426+
xorm.io/xorm v1.3.2-0.20220714055524-c3bce556200f h1:3NvNsM4lnttTsHpk8ODHqrwN1MCEjsO3bD/rpd8A47k=
2427+
xorm.io/xorm v1.3.2-0.20220714055524-c3bce556200f/go.mod h1:9NbjqdnjX6eyjRRhh01GHm64r6N9shTb/8Ak3YRt8Nw=

models/issues/issue_list.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ func (issues IssueList) loadAssignees(ctx context.Context) error {
242242
}
243243
rows, err := db.GetEngine(ctx).Table("issue_assignees").
244244
Join("INNER", "`user`", "`user`.id = `issue_assignees`.assignee_id").
245-
In("`issue_assignees`.issue_id", issueIDs[:limit]).
245+
In("`issue_assignees`.issue_id", issueIDs[:limit]).OrderBy(user_model.GetOrderByName()).
246246
Rows(new(AssigneeIssue))
247247
if err != nil {
248248
return err

models/migrations/v219.go

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99

1010
"code.gitea.io/gitea/models/repo"
1111
"code.gitea.io/gitea/modules/timeutil"
12+
1213
"xorm.io/xorm"
1314
)
1415

models/organization/team_repo.go

+1
Original file line numberDiff line numberDiff line change
@@ -81,5 +81,6 @@ func GetTeamsWithAccessToRepo(ctx context.Context, orgID, repoID int64, mode per
8181
Join("INNER", "team_repo", "team_repo.team_id = team.id").
8282
And("team_repo.org_id = ?", orgID).
8383
And("team_repo.repo_id = ?", repoID).
84+
OrderBy("name").
8485
Find(&teams)
8586
}

models/repo/user_repo.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ func GetRepoAssignees(ctx context.Context, repo *Repository) (_ []*user_model.Us
109109
// and just waste 1 unit is cheaper than re-allocate memory once.
110110
users := make([]*user_model.User, 0, len(userIDs)+1)
111111
if len(userIDs) > 0 {
112-
if err = e.In("id", userIDs).Find(&users); err != nil {
112+
if err = e.In("id", userIDs).OrderBy(user_model.GetOrderByName()).Find(&users); err != nil {
113113
return nil, err
114114
}
115115
}
@@ -168,5 +168,5 @@ func GetReviewers(ctx context.Context, repo *Repository, doerID, posterID int64)
168168
}
169169

170170
users := make([]*user_model.User, 0, 8)
171-
return users, db.GetEngine(ctx).Where(cond).OrderBy("name").Find(&users)
171+
return users, db.GetEngine(ctx).Where(cond).OrderBy(user_model.GetOrderByName()).Find(&users)
172172
}

0 commit comments

Comments
 (0)