Skip to content

Commit f80fe0f

Browse files
committed
Merge branch 'master' of https://github.com/go-gitea/gitea into fix-lfs-server
2 parents 9bc1cf6 + ce8255f commit f80fe0f

File tree

9 files changed

+45
-9
lines changed

9 files changed

+45
-9
lines changed

docs/content/doc/help/seek-help.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ If you found a bug, please create an [issue on GitHub](https://github.com/go-git
3333

3434
## Chinese Support
3535

36-
Support for the Chinese language is provided at [gocn.vip](https://gocn.vip/topic/gitea).
36+
Support for the Chinese language is provided at [Our discourse](https://discourse.gitea.io/c/5-category/5).

docs/content/doc/help/seek-help.zh-cn.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ menu:
1818
如果您在使用或者开发过程中遇到问题,请到以下渠道咨询:
1919

2020
-[Github issue](https://github.com/go-gitea/gitea/issues)提问(因为项目维护人员来自世界各地,为保证沟通顺畅,请使用英文提问)
21-
- 中文问题到[gocn.vip](https://gocn.vip/topic/gitea)提问
21+
- 中文问题到 [Gitea 论坛](https://discourse.gitea.io/c/5-category/5)提问
2222
- 访问 [Discord server - 英文](https://discord.gg/Gitea)
2323
- 加入 QQ群 328432459 获得进一步的支持

models/avatar.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func LibravatarURL(email string) (*url.URL, error) {
8181
}
8282

8383
// HashedAvatarLink returns an avatar link for a provided email
84-
func HashedAvatarLink(email string) string {
84+
func HashedAvatarLink(email string, size int) string {
8585
lowerEmail := strings.ToLower(strings.TrimSpace(email))
8686
sum := fmt.Sprintf("%x", md5.Sum([]byte(lowerEmail)))
8787
_, _ = cache.GetString("Avatar:"+sum, func() (string, error) {
@@ -108,6 +108,9 @@ func HashedAvatarLink(email string) string {
108108
}
109109
return lowerEmail, nil
110110
})
111+
if size > 0 {
112+
return setting.AppSubURL + "/avatar/" + url.PathEscape(sum) + "?size=" + strconv.Itoa(size)
113+
}
111114
return setting.AppSubURL + "/avatar/" + url.PathEscape(sum)
112115
}
113116

@@ -129,7 +132,7 @@ func SizedAvatarLink(email string, size int) string {
129132
// This is the slow path that would need to call LibravatarURL() which
130133
// does DNS lookups. Avoid it by issuing a redirect so we don't block
131134
// the template render with network requests.
132-
return HashedAvatarLink(email)
135+
return HashedAvatarLink(email, size)
133136
} else if !setting.DisableGravatar {
134137
// copy GravatarSourceURL, because we will modify its Path.
135138
copyOfGravatarSourceURL := *setting.GravatarSourceURL

models/migrations/v156.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ func fixPublisherIDforTagReleases(x *xorm.Engine) error {
8888
repo = new(Repository)
8989
has, err := sess.ID(release.RepoID).Get(repo)
9090
if err != nil {
91+
log.Error("Error whilst loading repository[%d] for release[%d] with tag name %s", release.RepoID, release.ID, release.TagName)
9192
return err
9293
} else if !has {
9394
log.Warn("Release[%d] is orphaned and refers to non-existing repository %d", release.ID, release.RepoID)
@@ -99,28 +100,37 @@ func fixPublisherIDforTagReleases(x *xorm.Engine) error {
99100
// v120.go migration may not have been run correctly - we'll just replicate it here
100101
// because this appears to be a common-ish problem.
101102
if _, err := sess.Exec("UPDATE repository SET owner_name = (SELECT name FROM `user` WHERE `user`.id = repository.owner_id)"); err != nil {
103+
log.Error("Error whilst updating repository[%d] owner name", repo.ID)
102104
return err
103105
}
104106

105107
if _, err := sess.ID(release.RepoID).Get(repo); err != nil {
108+
log.Error("Error whilst loading repository[%d] for release[%d] with tag name %s", release.RepoID, release.ID, release.TagName)
106109
return err
107110
}
108111
}
109112
gitRepo, err = git.OpenRepository(repoPath(repo.OwnerName, repo.Name))
110113
if err != nil {
114+
log.Error("Error whilst opening git repo for %-v", repo)
111115
return err
112116
}
113117
}
114118

115119
commit, err := gitRepo.GetTagCommit(release.TagName)
116120
if err != nil {
121+
if git.IsErrNotExist(err) {
122+
log.Warn("Unable to find commit %s for Tag: %s in %-v. Cannot update publisher ID.", err.(*git.ErrNotExist).ID, release.TagName, repo)
123+
continue
124+
}
125+
log.Error("Error whilst getting commit for Tag: %s in %-v.", release.TagName, repo)
117126
return fmt.Errorf("GetTagCommit: %v", err)
118127
}
119128

120129
if user == nil || !strings.EqualFold(user.Email, commit.Author.Email) {
121130
user = new(User)
122131
_, err = sess.Where("email=?", commit.Author.Email).Get(user)
123132
if err != nil {
133+
log.Error("Error whilst getting commit author by email: %s for Tag: %s in %-v.", commit.Author.Email, release.TagName, repo)
124134
return err
125135
}
126136

@@ -133,6 +143,7 @@ func fixPublisherIDforTagReleases(x *xorm.Engine) error {
133143

134144
release.PublisherID = user.ID
135145
if _, err := sess.ID(release.ID).Cols("publisher_id").Update(release); err != nil {
146+
log.Error("Error whilst updating publisher[%d] for release[%d] with tag name %s", release.PublisherID, release.ID, release.TagName)
136147
return err
137148
}
138149
}

models/user_avatar.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,19 @@ func (u *User) RealSizedAvatarLink(size int) string {
8282
if u.Avatar == "" {
8383
return DefaultAvatarLink()
8484
}
85+
if size > 0 {
86+
return setting.AppSubURL + "/avatars/" + u.Avatar + "?size=" + strconv.Itoa(size)
87+
}
8588
return setting.AppSubURL + "/avatars/" + u.Avatar
8689
case setting.DisableGravatar, setting.OfflineMode:
8790
if u.Avatar == "" {
8891
if err := u.GenerateRandomAvatar(); err != nil {
8992
log.Error("GenerateRandomAvatar: %v", err)
9093
}
9194
}
92-
95+
if size > 0 {
96+
return setting.AppSubURL + "/avatars/" + u.Avatar + "?size=" + strconv.Itoa(size)
97+
}
9398
return setting.AppSubURL + "/avatars/" + u.Avatar
9499
}
95100
return SizedAvatarLink(u.AvatarEmail, size)

modules/gitgraph/graph_models.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package gitgraph
77
import (
88
"bytes"
99
"fmt"
10+
"strings"
1011

1112
"code.gitea.io/gitea/models"
1213
"code.gitea.io/gitea/modules/git"
@@ -216,10 +217,10 @@ func newRefsFromRefNames(refNames []byte) []git.Reference {
216217
continue
217218
}
218219
refName := string(refNameBytes)
219-
if refName[0:5] == "tag: " {
220-
refName = refName[5:]
221-
} else if refName[0:8] == "HEAD -> " {
222-
refName = refName[8:]
220+
if strings.HasPrefix(refName, "tag: ") {
221+
refName = strings.TrimPrefix(refName, "tag: ")
222+
} else if strings.HasPrefix(refName, "HEAD -> ") {
223+
refName = strings.TrimPrefix(refName, "HEAD -> ")
223224
}
224225
refs = append(refs, git.Reference{
225226
Name: refName,

options/locale/locale_ja-JP.ini

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,7 @@ repositories=リポジトリ
420420
activity=公開アクティビティ
421421
followers=フォロワー
422422
starred=スター付きリポジトリ
423+
watched=ウォッチ中リポジトリ
423424
projects=プロジェクト
424425
following=フォロー中
425426
follow=フォロー
@@ -725,6 +726,10 @@ mirror_address=クローンするURL
725726
mirror_address_desc=必要な資格情報は「クローン時の認証」セクションに設定してください。
726727
mirror_address_url_invalid=入力したURLは無効です。 URLの構成要素はすべて正しくエスケープする必要があります。
727728
mirror_address_protocol_invalid=入力したURLは無効です。 ミラーできるのは、http(s):// または git:// の場所からだけです。
729+
mirror_lfs=Large File Storage (LFS)
730+
mirror_lfs_desc=LFS データのミラーリングを有効にする。
731+
mirror_lfs_endpoint=LFS エンドポイント
732+
mirror_lfs_endpoint_desc=同期するときは、クローンURLをもとに<a target="_blank" rel="noopener noreferrer" href="%s">LFSサーバーを決定</a>しようとします。 リポジトリのLFSデータがほかの場所に保存されている場合は、独自のエンドポイントを指定することができます。
728733
mirror_last_synced=前回の同期
729734
watchers=ウォッチャー
730735
stargazers=スターゲイザー
@@ -783,6 +788,11 @@ migrate_options=移行オプション
783788
migrate_service=移行するサービス
784789
migrate_options_mirror_helper=このリポジトリを<span class="text blue">ミラー</span>にする
785790
migrate_options_mirror_disabled=サイト管理者はミラーの新規作成を無効にしています。
791+
migrate_options_lfs=LFS ファイルのマイグレート
792+
migrate_options_lfs_endpoint.label=LFS エンドポイント
793+
migrate_options_lfs_endpoint.description=マイグレーションでは、リモート側のGitをもとに<a target="_blank" rel="noopener noreferrer" href="%s">LFSサーバーを決定</a>しようとします。 リポジトリのLFSデータがほかの場所に保存されている場合は、独自のエンドポイントを指定することができます。
794+
migrate_options_lfs_endpoint.description.local=ローカルサーバーのパスもサポートされています。
795+
migrate_options_lfs_endpoint.placeholder=クローン URL から派生するには空白のままにしてください。
786796
migrate_items=移行する項目
787797
migrate_items_wiki=Uncyclo
788798
migrate_items_milestones=マイルストーン
@@ -799,6 +809,7 @@ migrate.permission_denied=ローカルリポジトリをインポートする権
799809
migrate.permission_denied_blocked=ブロックしているホストからのインポートは禁止されています。
800810
migrate.permission_denied_private_ip=プライベートIPからのインポートは禁止されています。
801811
migrate.invalid_local_path=ローカルパスが無効です。 存在しないかディレクトリではありません。
812+
migrate.invalid_lfs_endpoint=LFS エンドポイントが無効です。
802813
migrate.failed=移行に失敗しました: %v
803814
migrate.migrate_items_options=追加の項目を移行するにはアクセストークンが必要です
804815
migrated_from=<a href="%[1]s">%[2]s</a>から移行
@@ -1112,6 +1123,8 @@ issues.context.edit=編集
11121123
issues.context.delete=削除
11131124
issues.no_content=まだ内容がありません
11141125
issues.close_issue=クローズする
1126+
issues.pull_merged_at=`がコミット <a class="ui sha" href="%[1]s"><code>%[2]s</code></a> を <b>%[3]s</b> にマージ %[4]s`
1127+
issues.manually_pull_merged_at=`がコミット <a class="ui sha" href="%[1]s"><code>%[2]s</code></a> を <b>%[3]s</b> に手動マージ %[4]s`
11151128
issues.close_comment_issue=コメントしてクローズ
11161129
issues.reopen_issue=再オープンする
11171130
issues.reopen_comment_issue=コメントして再オープン
@@ -1205,6 +1218,7 @@ issues.error_modifying_due_date=期日を変更できませんでした。
12051218
issues.error_removing_due_date=期日を削除できませんでした。
12061219
issues.push_commit_1=が %d コミット追加 %s
12071220
issues.push_commits_n=が %d コミット追加 %s
1221+
issues.force_push_codes=`が %[1]s を強制プッシュ ( <a class="ui sha" href="%[3]s"><code>%[2]s</code></a> から <a class="ui sha" href="%[5]s"><code>%[4]s</code></a> へ ) %[6]s`
12081222
issues.due_date_form=yyyy-mm-dd
12091223
issues.due_date_form_add=期日の追加
12101224
issues.due_date_form_edit=変更

options/locale/locale_pt-BR.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@ repositories=Repositórios
418418
activity=Atividade pública
419419
followers=Seguidores
420420
starred=Repositórios favoritos
421+
watched=Repositórios observados
421422
projects=Projetos
422423
following=Seguindo
423424
follow=Seguir

options/locale/locale_pt-PT.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,7 @@ repositories=Repositórios
415415
activity=Trabalho público
416416
followers=Seguidores
417417
starred=Repositórios favoritos
418+
watched=Repositórios sob vigilância
418419
projects=Projectos
419420
following=Que segue
420421
follow=Seguir

0 commit comments

Comments
 (0)