Skip to content

Commit 3e3902a

Browse files
committed
Merge branch 'main' into lunny/adjust_object_format
2 parents 605326f + e85db6c commit 3e3902a

9 files changed

+19
-19
lines changed

docs/content/administration/adding-legal-pages.en-us.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ Some jurisdictions (such as EU), requires certain legal pages (e.g. Privacy Poli
1919

2020
## Getting Pages
2121

22-
Gitea source code ships with sample pages, available in `contrib/legal` directory. Copy them to `custom/public/`. For example, to add Privacy Policy:
22+
Gitea source code ships with sample pages, available in `contrib/legal` directory. Copy them to `custom/public/assets/`. For example, to add Privacy Policy:
2323

2424
```
25-
wget -O /path/to/custom/public/privacy.html https://raw.githubusercontent.com/go-gitea/gitea/main/contrib/legal/privacy.html.sample
25+
wget -O /path/to/custom/public/assets/privacy.html https://raw.githubusercontent.com/go-gitea/gitea/main/contrib/legal/privacy.html.sample
2626
```
2727

2828
Now you need to edit the page to meet your requirements. In particular you must change the email addresses, web addresses and references to "Your Gitea Instance" to match your situation.

docs/content/administration/adding-legal-pages.zh-cn.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ menu:
1919

2020
## 获取页面
2121

22-
Gitea 源代码附带了示例页面,位于 `contrib/legal` 目录中。将它们复制到 `custom/public/` 目录下。例如,如果要添加隐私政策:
22+
Gitea 源代码附带了示例页面,位于 `contrib/legal` 目录中。将它们复制到 `custom/public/assets/` 目录下。例如,如果要添加隐私政策:
2323

2424
```
25-
wget -O /path/to/custom/public/privacy.html https://raw.githubusercontent.com/go-gitea/gitea/main/contrib/legal/privacy.html.sample
25+
wget -O /path/to/custom/public/assets/privacy.html https://raw.githubusercontent.com/go-gitea/gitea/main/contrib/legal/privacy.html.sample
2626
```
2727

2828
现在,你需要编辑该页面以满足你的需求。特别是,你必须更改电子邮件地址、网址以及与 "Your Gitea Instance" 相关的引用,以匹配你的情况。

docs/content/administration/customizing-gitea.zh-cn.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ Gitea 引用 `custom` 目录中的自定义配置文件来覆盖配置、模板
4242

4343
将自定义的公共文件(比如页面和图片)作为 webroot 放在 `custom/public/` 中来让 Gitea 提供这些自定义内容(符号链接将被追踪)。
4444

45-
举例说明:`image.png` 存放在 `custom/public/`中,那么它可以通过链接 http://gitea.domain.tld/assets/image.png 访问。
45+
举例说明:`image.png` 存放在 `custom/public/assets/`中,那么它可以通过链接 http://gitea.domain.tld/assets/image.png 访问。
4646

4747
## 修改默认头像
4848

49-
替换以下目录中的 png 图片: `custom/public/img/avatar\_default.png`
49+
替换以下目录中的 png 图片: `custom/public/assets/img/avatar\_default.png`
5050

5151
## 自定义 Gitea 页面
5252

docs/content/administration/external-renderers.zh-cn.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ ALLOW_DATA_URI_IMAGES = true
194194
}
195195
```
196196

197-
将您的样式表添加到自定义目录中,例如 `custom/public/css/my-style-XXXXX.css`,并使用自定义的头文件 `custom/templates/custom/header.tmpl` 进行导入:
197+
将您的样式表添加到自定义目录中,例如 `custom/public/assets/css/my-style-XXXXX.css`,并使用自定义的头文件 `custom/templates/custom/header.tmpl` 进行导入:
198198

199199
```html
200200
<link rel="stylesheet" href="{{AppSubUrl}}/assets/css/my-style-XXXXX.css" />

docs/content/help/faq.zh-cn.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ Gitea 目前支持三个官方主题,分别是 `gitea-light`、`gitea-dark`
189189

190190
假设我们的主题是 `arc-blue`(这是一个真实的主题,可以在[此问题](https://github.com/go-gitea/gitea/issues/6011)中找到)
191191

192-
`.css`文件命名为`theme-arc-blue.css`并将其添加到`custom/public/css`文件夹中
192+
`.css`文件命名为`theme-arc-blue.css`并将其添加到`custom/public/assets/css`文件夹中
193193

194194
通过将`arc-blue`添加到`app.ini`中的`THEMES`列表中,允许用户使用该主题
195195

modules/git/git.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ var (
3333
// DefaultContext is the default context to run git commands in, must be initialized by git.InitXxx
3434
DefaultContext context.Context
3535

36-
// SupportProcReceive version >= 2.29.0
37-
SupportProcReceive bool
36+
SupportProcReceive bool // >= 2.29
37+
SupportHashSha256 bool // >= 2.42, SHA-256 repositories no longer an ‘experimental curiosity’
3838

3939
gitVersion *version.Version
4040
)
@@ -189,7 +189,7 @@ func InitFull(ctx context.Context) (err error) {
189189
globalCommandArgs = append(globalCommandArgs, "-c", "credential.helper=")
190190
}
191191
SupportProcReceive = CheckGitVersionAtLeast("2.29") == nil
192-
192+
SupportHashSha256 = CheckGitVersionAtLeast("2.42") == nil
193193
if setting.LFS.StartServer {
194194
if CheckGitVersionAtLeast("2.1.2") != nil {
195195
return errors.New("LFS server support requires Git >= 2.1.2")

modules/git/object_format.go

-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ type ObjectFormat interface {
3131
NewHasher() HasherInterface
3232
}
3333

34-
/* SHA1 Type */
3534
type Sha1ObjectFormat struct{}
3635

3736
func (Sha1ObjectFormat) String() string { return "sha1" }

modules/git/object_id.go

+3-5
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ type ObjectID interface {
2020
Type() ObjectFormat
2121
}
2222

23-
/* SHA1 */
2423
type Sha1Hash [20]byte
2524

2625
func (h *Sha1Hash) String() string {
@@ -38,7 +37,7 @@ func NewSha1() *Sha1Hash {
3837
return &Sha1Hash{}
3938
}
4039

41-
// generic implementations
40+
// NewHash is for generic implementations
4241
func NewHash(hash string) (ObjectID, error) {
4342
hash = strings.ToLower(hash)
4443
switch hash {
@@ -73,7 +72,6 @@ func genericIDFromString(h ObjectFormat, s string) (ObjectID, error) {
7372
return h.NewID(b)
7473
}
7574

76-
// utils
7775
func IDFromString(hexHash string) (ObjectID, error) {
7876
switch len(hexHash) {
7977
case 40:
@@ -101,7 +99,7 @@ func IsEmptyCommitID(commitID string) bool {
10199
return id.IsZero()
102100
}
103101

104-
// HashInterface is a struct that will generate a Hash
102+
// HasherInterface is a struct that will generate a Hash
105103
type HasherInterface interface {
106104
hash.Hash
107105

@@ -127,7 +125,7 @@ func ComputeHash(hashType ObjectFormat, t ObjectType, content []byte) ObjectID {
127125
return h.HashSum()
128126
}
129127

130-
// Sum generates a SHA1 for the provided hash
128+
// HashSum generates a SHA1 for the provided hash
131129
func (h *Sha1Hasher) HashSum() ObjectID {
132130
var sha1 Sha1Hash
133131
copy(sha1[:], h.Hash.Sum(nil))

modules/git/repo.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func IsRepoURLAccessible(ctx context.Context, url string) bool {
6363
return err == nil
6464
}
6565

66-
// GetObjectFormatOfRepo returns the hash type of a repository at a given path
66+
// GetObjectFormatOfRepo returns the hash type of repository at a given path
6767
func GetObjectFormatOfRepo(ctx context.Context, repoPath string) (ObjectFormat, error) {
6868
var stdout, stderr strings.Builder
6969

@@ -96,7 +96,10 @@ func InitRepository(ctx context.Context, repoPath string, bare bool, objectForma
9696
return err
9797
}
9898

99-
cmd := NewCommand(ctx, "init", "--object-format").AddDynamicArguments(objectFormat.String())
99+
cmd := NewCommand(ctx, "init")
100+
if SupportHashSha256 {
101+
cmd.AddOptionValues("--object-format", objectFormat.String())
102+
}
100103
if bare {
101104
cmd.AddArguments("--bare")
102105
}

0 commit comments

Comments
 (0)