mirror of
				https://codeberg.org/forgejo/forgejo.git
				synced 2025-10-31 06:21:11 +00:00 
			
		
		
		
	Initial support for push options (#12169)
* Initial support for push options Signed-off-by: jolheiser <john.olheiser@gmail.com> * Fix misspelling 🤦 Signed-off-by: jolheiser <john.olheiser@gmail.com> * Fix formatting after conflict resolution * defer close git repo * According the GitLab documentation, git >= 2.10 Signed-off-by: jolheiser <john.olheiser@gmail.com> * Words are hard. Thanks @mrsdizzie 😅 Co-authored-by: mrsdizzie <info@mrsdizzie.com> * Only update if there are push options Signed-off-by: jolheiser <john.olheiser@gmail.com> Co-authored-by: mrsdizzie <info@mrsdizzie.com>
This commit is contained in:
		
					parent
					
						
							
								e7d65cbc6e
							
						
					
				
			
			
				commit
				
					
						43a397ce9a
					
				
			
		
					 6 changed files with 118 additions and 0 deletions
				
			
		|  | @ -436,6 +436,18 @@ func HookPostReceive(ctx *macaron.Context, opts private.HookOptions) { | |||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	// Push Options | ||||
| 	if repo != nil && len(opts.GitPushOptions) > 0 { | ||||
| 		repo.IsPrivate = opts.GitPushOptions.Bool(private.GitPushOptionRepoPrivate, repo.IsPrivate) | ||||
| 		repo.IsTemplate = opts.GitPushOptions.Bool(private.GitPushOptionRepoTemplate, repo.IsTemplate) | ||||
| 		if err := models.UpdateRepositoryCols(repo, "is_private", "is_template"); err != nil { | ||||
| 			log.Error("Failed to Update: %s/%s Error: %v", ownerName, repoName, err) | ||||
| 			ctx.JSON(http.StatusInternalServerError, private.HookPostReceiveResult{ | ||||
| 				Err: fmt.Sprintf("Failed to Update: %s/%s Error: %v", ownerName, repoName, err), | ||||
| 			}) | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	results := make([]private.HookPostReceiveBranchResult, 0, len(opts.OldCommitIDs)) | ||||
| 
 | ||||
| 	// We have to reload the repo in case its state is changed above | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue