DEV: Do not squash commits in version_bump:stage_security_fixes (#23547)

Sometimes fixes will deliberately keep commits separate, and we don't want to undo that
This commit is contained in:
David Taylor 2023-09-12 18:00:42 +01:00 committed by GitHub
parent a32fa3b947
commit 8b51a89919
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View File

@ -406,11 +406,7 @@ task "version_bump:stage_security_fixes", [:base] do |t, args|
git "fetch", origin, origin_branch
first_commit_on_branch = git("log", "--format=%H", "origin/#{base}..#{ref}").lines.last.strip
author = git("log", "-n", "1", "--format=%an <%ae>", first_commit_on_branch).strip
message = git("log", "-n", "1", "--format=%B", first_commit_on_branch).strip
git "merge", "--squash", ref
git "commit", "--author", author, "-m", message
git "cherry-pick", "#{first_commit_on_branch}^..#{ref}"
end
puts "Finished merging commits into a locally-staged #{branch} branch. Git log is:"

View File

@ -213,7 +213,12 @@ RSpec.describe "tasks/version_bump" do
Dir.chdir(origin_path) do
# Check each fix has been added as a single commit, with the message matching the first commit on the branch
expect(run("git", "log", "--pretty=%s", "main").lines.map(&:strip)).to eq(
["security fix two", "security fix one, commit one", "Initial commit"],
[
"security fix two",
"security fix one, commit two",
"security fix one, commit one",
"Initial commit",
],
)
# Check all the files from both fixes are present