mirror of
				https://codeberg.org/forgejo/forgejo.git
				synced 2025-11-04 00:11:04 +00:00 
			
		
		
		
	[gitea] week 2025-12 cherry pick (gitea/main -> forgejo) (#7220)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7220 Reviewed-by: Gusted <gusted@noreply.codeberg.org>
This commit is contained in:
		
				commit
				
					
						a624b6a8f4
					
				
			
		
					 3 changed files with 20 additions and 24 deletions
				
			
		| 
						 | 
					@ -1381,10 +1381,8 @@ func GetWhitespaceFlag(whitespaceBehavior string) git.TrustedCmdArgs {
 | 
				
			||||||
		"ignore-eol":    {"--ignore-space-at-eol"},
 | 
							"ignore-eol":    {"--ignore-space-at-eol"},
 | 
				
			||||||
		"show-all":      nil,
 | 
							"show-all":      nil,
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					 | 
				
			||||||
	if flag, ok := whitespaceFlags[whitespaceBehavior]; ok {
 | 
						if flag, ok := whitespaceFlags[whitespaceBehavior]; ok {
 | 
				
			||||||
		return flag
 | 
							return flag
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	log.Warn("unknown whitespace behavior: %q, default to 'show-all'", whitespaceBehavior)
 | 
					 | 
				
			||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -23,6 +23,7 @@ import (
 | 
				
			||||||
	repo_module "code.gitea.io/gitea/modules/repository"
 | 
						repo_module "code.gitea.io/gitea/modules/repository"
 | 
				
			||||||
	"code.gitea.io/gitea/modules/setting"
 | 
						"code.gitea.io/gitea/modules/setting"
 | 
				
			||||||
	"code.gitea.io/gitea/modules/timeutil"
 | 
						"code.gitea.io/gitea/modules/timeutil"
 | 
				
			||||||
 | 
						"code.gitea.io/gitea/modules/util"
 | 
				
			||||||
	issue_service "code.gitea.io/gitea/services/issue"
 | 
						issue_service "code.gitea.io/gitea/services/issue"
 | 
				
			||||||
	notify_service "code.gitea.io/gitea/services/notify"
 | 
						notify_service "code.gitea.io/gitea/services/notify"
 | 
				
			||||||
	pull_service "code.gitea.io/gitea/services/pull"
 | 
						pull_service "code.gitea.io/gitea/services/pull"
 | 
				
			||||||
| 
						 | 
					@ -133,23 +134,26 @@ func pushUpdates(optsList []*repo_module.PushUpdateOptions) error {
 | 
				
			||||||
			} else { // is new tag
 | 
								} else { // is new tag
 | 
				
			||||||
				newCommit, err := gitRepo.GetCommit(opts.NewCommitID)
 | 
									newCommit, err := gitRepo.GetCommit(opts.NewCommitID)
 | 
				
			||||||
				if err != nil {
 | 
									if err != nil {
 | 
				
			||||||
					return fmt.Errorf("gitRepo.GetCommit(%s) in %s/%s[%d]: %w", opts.NewCommitID, repo.OwnerName, repo.Name, repo.ID, err)
 | 
										// in case there is dirty data, for example, the "github.com/git/git" repository has tags pointing to non-existing commits
 | 
				
			||||||
 | 
										if !errors.Is(err, util.ErrNotExist) {
 | 
				
			||||||
 | 
											log.Error("Unable to get tag commit: gitRepo.GetCommit(%s) in %s/%s[%d]: %v", opts.NewCommitID, repo.OwnerName, repo.Name, repo.ID, err)
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									} else {
 | 
				
			||||||
 | 
										commits := repo_module.NewPushCommits()
 | 
				
			||||||
 | 
										commits.HeadCommit = repo_module.CommitToPushCommit(newCommit)
 | 
				
			||||||
 | 
										commits.CompareURL = repo.ComposeCompareURL(objectFormat.EmptyObjectID().String(), opts.NewCommitID)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
										notify_service.PushCommits(
 | 
				
			||||||
 | 
											ctx, pusher, repo,
 | 
				
			||||||
 | 
											&repo_module.PushUpdateOptions{
 | 
				
			||||||
 | 
												RefFullName: opts.RefFullName,
 | 
				
			||||||
 | 
												OldCommitID: objectFormat.EmptyObjectID().String(),
 | 
				
			||||||
 | 
												NewCommitID: opts.NewCommitID,
 | 
				
			||||||
 | 
											}, commits)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
										addTags = append(addTags, tagName)
 | 
				
			||||||
 | 
										notify_service.CreateRef(ctx, pusher, repo, opts.RefFullName, opts.NewCommitID)
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					 | 
				
			||||||
				commits := repo_module.NewPushCommits()
 | 
					 | 
				
			||||||
				commits.HeadCommit = repo_module.CommitToPushCommit(newCommit)
 | 
					 | 
				
			||||||
				commits.CompareURL = repo.ComposeCompareURL(objectFormat.EmptyObjectID().String(), opts.NewCommitID)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
				notify_service.PushCommits(
 | 
					 | 
				
			||||||
					ctx, pusher, repo,
 | 
					 | 
				
			||||||
					&repo_module.PushUpdateOptions{
 | 
					 | 
				
			||||||
						RefFullName: opts.RefFullName,
 | 
					 | 
				
			||||||
						OldCommitID: objectFormat.EmptyObjectID().String(),
 | 
					 | 
				
			||||||
						NewCommitID: opts.NewCommitID,
 | 
					 | 
				
			||||||
					}, commits)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
				addTags = append(addTags, tagName)
 | 
					 | 
				
			||||||
				notify_service.CreateRef(ctx, pusher, repo, opts.RefFullName, opts.NewCommitID)
 | 
					 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		} else if opts.RefFullName.IsBranch() {
 | 
							} else if opts.RefFullName.IsBranch() {
 | 
				
			||||||
			if pusher == nil || pusher.ID != opts.PusherID {
 | 
								if pusher == nil || pusher.ID != opts.PusherID {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -20,12 +20,6 @@
 | 
				
			||||||
	<link rel="icon" href="{{AssetUrlPrefix}}/img/favicon.svg" type="image/svg+xml">
 | 
						<link rel="icon" href="{{AssetUrlPrefix}}/img/favicon.svg" type="image/svg+xml">
 | 
				
			||||||
	<link rel="alternate icon" href="{{AssetUrlPrefix}}/img/favicon.png" type="image/png">
 | 
						<link rel="alternate icon" href="{{AssetUrlPrefix}}/img/favicon.png" type="image/png">
 | 
				
			||||||
	{{template "base/head_script" .}}
 | 
						{{template "base/head_script" .}}
 | 
				
			||||||
	<noscript>
 | 
					 | 
				
			||||||
		<style>
 | 
					 | 
				
			||||||
			.dropdown:hover > .menu { display: block; }
 | 
					 | 
				
			||||||
			.ui.secondary.menu .dropdown.item > .menu { margin-top: 0; }
 | 
					 | 
				
			||||||
		</style>
 | 
					 | 
				
			||||||
	</noscript>
 | 
					 | 
				
			||||||
	{{template "shared/user/mention_highlight" .}}
 | 
						{{template "shared/user/mention_highlight" .}}
 | 
				
			||||||
	{{template "base/head_opengraph" .}}
 | 
						{{template "base/head_opengraph" .}}
 | 
				
			||||||
	{{template "base/head_style" .}}
 | 
						{{template "base/head_style" .}}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue