mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 21:28:11 +09:00 
			
		
		
		
	Move PushUpdate dependency from models to repofiles (#6763)
* remove push_update * move models.PushUpdate to repofiles.PushUpdate
This commit is contained in:
		| @@ -394,7 +394,8 @@ func CreateOrUpdateRepoFile(repo *models.Repository, doer *models.User, opts *Up | ||||
| 	if err = repo.GetOwner(); err != nil { | ||||
| 		return nil, fmt.Errorf("GetOwner: %v", err) | ||||
| 	} | ||||
| 	err = models.PushUpdate( | ||||
| 	err = PushUpdate( | ||||
| 		repo, | ||||
| 		opts.NewBranch, | ||||
| 		models.PushUpdateOptions{ | ||||
| 			PusherID:     doer.ID, | ||||
| @@ -409,7 +410,6 @@ func CreateOrUpdateRepoFile(repo *models.Repository, doer *models.User, opts *Up | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("PushUpdate: %v", err) | ||||
| 	} | ||||
| 	models.UpdateRepoIndexer(repo) | ||||
|  | ||||
| 	commit, err = t.GetCommit(commitHash) | ||||
| 	if err != nil { | ||||
| @@ -422,3 +422,17 @@ func CreateOrUpdateRepoFile(repo *models.Repository, doer *models.User, opts *Up | ||||
| 	} | ||||
| 	return file, nil | ||||
| } | ||||
|  | ||||
| // PushUpdate must be called for any push actions in order to | ||||
| // generates necessary push action history feeds and other operations | ||||
| func PushUpdate(repo *models.Repository, branch string, opts models.PushUpdateOptions) error { | ||||
| 	err := models.PushUpdate(branch, opts) | ||||
| 	if err != nil { | ||||
| 		return fmt.Errorf("PushUpdate: %v", err) | ||||
| 	} | ||||
|  | ||||
| 	if opts.RefFullName == git.BranchPrefix+repo.DefaultBranch { | ||||
| 		models.UpdateRepoIndexer(repo) | ||||
| 	} | ||||
| 	return nil | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user