mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-11-04 01:34:27 +00:00 
			
		
		
		
	Remove unnecessary loading of settings in update hook (#9496)
This PR simply makes update an empty command rather than needlessly load the settings for each reference.
This commit is contained in:
		
							
								
								
									
										13
									
								
								cmd/hook.go
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								cmd/hook.go
									
									
									
									
									
								
							@@ -181,18 +181,7 @@ Gitea or set your environment appropriately.`, "")
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func runHookUpdate(c *cli.Context) error {
 | 
					func runHookUpdate(c *cli.Context) error {
 | 
				
			||||||
	if len(os.Getenv("SSH_ORIGINAL_COMMAND")) == 0 {
 | 
						// Update is empty and is kept only for backwards compatibility
 | 
				
			||||||
		if setting.OnlyAllowPushIfGiteaEnvironmentSet {
 | 
					 | 
				
			||||||
			fail(`Rejecting changes as Gitea environment not set.
 | 
					 | 
				
			||||||
If you are pushing over SSH you must push with a key managed by
 | 
					 | 
				
			||||||
Gitea or set your environment appropriately.`, "")
 | 
					 | 
				
			||||||
		} else {
 | 
					 | 
				
			||||||
			return nil
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	setup("hooks/update.log", false)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user