Skip to content

Commit a624b6a

Browse files
author
Earl Warren
committed
[gitea] week 2025-12 cherry pick (gitea/main -> forgejo) (go-gitea#7220)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7220 Reviewed-by: Gusted <[email protected]>
2 parents d5c8091 + 0dfa5d0 commit a624b6a

File tree

3 files changed

+20
-24
lines changed

3 files changed

+20
-24
lines changed

services/gitdiff/gitdiff.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1381,10 +1381,8 @@ func GetWhitespaceFlag(whitespaceBehavior string) git.TrustedCmdArgs {
13811381
"ignore-eol": {"--ignore-space-at-eol"},
13821382
"show-all": nil,
13831383
}
1384-
13851384
if flag, ok := whitespaceFlags[whitespaceBehavior]; ok {
13861385
return flag
13871386
}
1388-
log.Warn("unknown whitespace behavior: %q, default to 'show-all'", whitespaceBehavior)
13891387
return nil
13901388
}

services/repository/push.go

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
repo_module "code.gitea.io/gitea/modules/repository"
2424
"code.gitea.io/gitea/modules/setting"
2525
"code.gitea.io/gitea/modules/timeutil"
26+
"code.gitea.io/gitea/modules/util"
2627
issue_service "code.gitea.io/gitea/services/issue"
2728
notify_service "code.gitea.io/gitea/services/notify"
2829
pull_service "code.gitea.io/gitea/services/pull"
@@ -133,23 +134,26 @@ func pushUpdates(optsList []*repo_module.PushUpdateOptions) error {
133134
} else { // is new tag
134135
newCommit, err := gitRepo.GetCommit(opts.NewCommitID)
135136
if err != nil {
136-
return fmt.Errorf("gitRepo.GetCommit(%s) in %s/%s[%d]: %w", opts.NewCommitID, repo.OwnerName, repo.Name, repo.ID, err)
137+
// in case there is dirty data, for example, the "github.com/git/git" repository has tags pointing to non-existing commits
138+
if !errors.Is(err, util.ErrNotExist) {
139+
log.Error("Unable to get tag commit: gitRepo.GetCommit(%s) in %s/%s[%d]: %v", opts.NewCommitID, repo.OwnerName, repo.Name, repo.ID, err)
140+
}
141+
} else {
142+
commits := repo_module.NewPushCommits()
143+
commits.HeadCommit = repo_module.CommitToPushCommit(newCommit)
144+
commits.CompareURL = repo.ComposeCompareURL(objectFormat.EmptyObjectID().String(), opts.NewCommitID)
145+
146+
notify_service.PushCommits(
147+
ctx, pusher, repo,
148+
&repo_module.PushUpdateOptions{
149+
RefFullName: opts.RefFullName,
150+
OldCommitID: objectFormat.EmptyObjectID().String(),
151+
NewCommitID: opts.NewCommitID,
152+
}, commits)
153+
154+
addTags = append(addTags, tagName)
155+
notify_service.CreateRef(ctx, pusher, repo, opts.RefFullName, opts.NewCommitID)
137156
}
138-
139-
commits := repo_module.NewPushCommits()
140-
commits.HeadCommit = repo_module.CommitToPushCommit(newCommit)
141-
commits.CompareURL = repo.ComposeCompareURL(objectFormat.EmptyObjectID().String(), opts.NewCommitID)
142-
143-
notify_service.PushCommits(
144-
ctx, pusher, repo,
145-
&repo_module.PushUpdateOptions{
146-
RefFullName: opts.RefFullName,
147-
OldCommitID: objectFormat.EmptyObjectID().String(),
148-
NewCommitID: opts.NewCommitID,
149-
}, commits)
150-
151-
addTags = append(addTags, tagName)
152-
notify_service.CreateRef(ctx, pusher, repo, opts.RefFullName, opts.NewCommitID)
153157
}
154158
} else if opts.RefFullName.IsBranch() {
155159
if pusher == nil || pusher.ID != opts.PusherID {

templates/base/head.tmpl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,6 @@
2020
<link rel="icon" href="{{AssetUrlPrefix}}/img/favicon.svg" type="image/svg+xml">
2121
<link rel="alternate icon" href="{{AssetUrlPrefix}}/img/favicon.png" type="image/png">
2222
{{template "base/head_script" .}}
23-
<noscript>
24-
<style>
25-
.dropdown:hover > .menu { display: block; }
26-
.ui.secondary.menu .dropdown.item > .menu { margin-top: 0; }
27-
</style>
28-
</noscript>
2923
{{template "shared/user/mention_highlight" .}}
3024
{{template "base/head_opengraph" .}}
3125
{{template "base/head_style" .}}

0 commit comments

Comments
 (0)