Skip to content

Commit

Permalink
Merge branch 'main' into jakecoffman/push-after-approval
Browse files Browse the repository at this point in the history
  • Loading branch information
jakecoffman authored Sep 6, 2022
2 parents 19f392e + c41ea8f commit ab12147
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
4 changes: 3 additions & 1 deletion common/lib/dependabot/pull_request_creator/branch_namer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ def dependency_set
def branch_version_suffix
dep = dependencies.first

if library? && ref_changed?(dep) && new_ref(dep)
if dep.removed?
"-removed"
elsif library? && ref_changed?(dep) && new_ref(dep)
new_ref(dep)
elsif library?
sanitized_requirement(dep)
Expand Down
37 changes: 37 additions & 0 deletions common/spec/dependabot/pull_request_creator/branch_namer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,43 @@
end
end

context "with a removed transitive dependency" do
let(:dependencies) { [removed_dep, parent_dep] }
let(:removed_dep) do
Dependabot::Dependency.new(
name: "business",
version: nil,
previous_version: "1.4.0",
package_manager: "dummy",
requirements: [],
previous_requirements: [],
removed: true
)
end
let(:parent_dep) do
Dependabot::Dependency.new(
name: "statesman",
version: "1.5.0",
previous_version: "1.4.0",
package_manager: "dummy",
requirements: [{
file: "Gemfile",
requirement: "~> 1.5.0",
groups: [],
source: nil
}],
previous_requirements: [{
file: "Gemfile",
requirement: "~> 1.4.0",
groups: [],
source: nil
}]
)
end

it { is_expected.to eq("dependabot/dummy/business-and-statesman--removed") }
end

context "with a : in the name" do
let(:dependency) do
Dependabot::Dependency.new(
Expand Down

0 comments on commit ab12147

Please sign in to comment.