Skip to content

Commit

Permalink
Merge branch 'main' into kamil/update_package_manager_abstraction_for…
Browse files Browse the repository at this point in the history
…_bundler_and_composer
  • Loading branch information
kbukum1 authored Oct 24, 2024
2 parents 634405d + 4727f38 commit fafd29d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
6 changes: 6 additions & 0 deletions common/lib/dependabot/pull_request_creator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,12 @@ def message

sig { returns(Dependabot::PullRequestCreator::BranchNamer) }
def branch_namer
if Dependabot::Experiments.enabled?(:dedup_branch_names) && existing_branches
Dependabot.logger.debug(
"Dependabot::PullRequestCreator::branch_namer : #{existing_branches}"
)
end

@branch_namer ||= T.let(
BranchNamer.new(
dependencies: dependencies,
Expand Down
6 changes: 6 additions & 0 deletions common/lib/dependabot/pull_request_creator/branch_namer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ def new_branch_name

sig { returns(Dependabot::PullRequestCreator::BranchNamer::Base) }
def strategy
if Dependabot::Experiments.enabled?(:dedup_branch_names) && existing_branches
Dependabot.logger.debug(
"Dependabot::PullRequestCreator::strategy : #{existing_branches}"
)
end

@strategy ||= T.let(
if dependency_group.nil?
SoloStrategy.new(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ def sanitize_branch_name(ref_name)

sig { params(ref: String).returns(String) }
def dedup_existing_branches(ref)
Dependabot.logger.debug(
"Dependabot::PullRequestCreator::dedup_existing_branches::ref : #{ref}"
)
return ref unless existing_branches.include?(ref)

i = 1
Expand All @@ -92,6 +95,10 @@ def dedup_existing_branches(ref)
new_ref = "#{ref}-#{i}"
end

Dependabot.logger.debug(
"Dependabot::PullRequestCreator::dedup_existing_branches::new_ref : #{new_ref}"
)

new_ref
end

Expand Down

0 comments on commit fafd29d

Please sign in to comment.