Skip to content
Snippets Groups Projects
Commit a47b0d80 authored by Rémy Coutable's avatar Rémy Coutable
Browse files

Don't pass `env` anymore to GitAccess, ChangeAccess, and ForcePush


Signed-off-by: default avatarRémy Coutable <remy@rymai.me>

Former-commit-id: 3de11e1a
parent 42d63b17
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -5,7 +5,7 @@ module Gitlab
attr_reader :user_access, :project, :skip_authorization, :protocol
 
def initialize(
change, user_access:, project:, env: {}, skip_authorization: false,
change, user_access:, project:, skip_authorization: false,
protocol:
)
@oldrev, @newrev, @ref = change.values_at(:oldrev, :newrev, :ref)
Loading
Loading
@@ -13,7 +13,6 @@ module Gitlab
@tag_name = Gitlab::Git.tag_name(@ref)
@user_access = user_access
@project = project
@env = env
@skip_authorization = skip_authorization
@protocol = protocol
end
Loading
Loading
@@ -97,7 +96,7 @@ module Gitlab
end
 
def forced_push?
Gitlab::Checks::ForcePush.force_push?(@project, @oldrev, @newrev, env: @env)
Gitlab::Checks::ForcePush.force_push?(@project, @oldrev, @newrev)
end
 
def update?
Loading
Loading
module Gitlab
module Checks
class ForcePush
def self.force_push?(project, oldrev, newrev, env: {})
def self.force_push?(project, oldrev, newrev)
return false if project.empty_repo?
 
# Created or deleted branch
Loading
Loading
Loading
Loading
@@ -18,13 +18,12 @@ module Gitlab
 
attr_reader :actor, :project, :protocol, :user_access, :authentication_abilities
 
def initialize(actor, project, protocol, authentication_abilities:, env: {})
def initialize(actor, project, protocol, authentication_abilities:)
@actor = actor
@project = project
@protocol = protocol
@authentication_abilities = authentication_abilities
@user_access = UserAccess.new(user, project: project)
@env = env
end
 
def check(cmd, changes)
Loading
Loading
@@ -152,7 +151,6 @@ module Gitlab
change,
user_access: user_access,
project: project,
env: @env,
skip_authorization: deploy_key?,
protocol: protocol
).exec
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment