Skip to content

Commit

Permalink
Merge pull request Homebrew#9092 from Rylan12/fix-checksum-audit
Browse files Browse the repository at this point in the history
audit: fix checksum audit
  • Loading branch information
Rylan12 committed Nov 10, 2020
2 parents 49bb256 + 67127cb commit e05b0fc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Library/Homebrew/dev-cmd/audit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,7 @@ def audit_revision_and_version_scheme
break if previous_revision && current_revision != previous_revision
end

if current_version == previous_version &&
if current_version == newest_committed_version &&
current_checksum != newest_committed_checksum
problem(
"stable sha256 changed without the version also changing; " \
Expand Down
17 changes: 17 additions & 0 deletions Library/Homebrew/test/dev-cmd/audit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,23 @@ def formula_gsub_origin_commit(before, after = "")
it { is_expected.to match("stable sha256 changed without the version also changing") }
end

context "should not change with the same version when not the first commit" do
before do
formula_gsub_origin_commit(
'sha256 "31cccfc6630528db1c8e3a06f6decf2a370060b982841cfab2b8677400a5092e"',
'sha256 "3622d2a53236ed9ca62de0616a7e80fd477a9a3f862ba09d503da188f53ca523"',
)
formula_gsub_origin_commit "revision 2"
formula_gsub_origin_commit "foo-1.0.tar.gz", "foo-1.1.tar.gz"
formula_gsub(
'sha256 "3622d2a53236ed9ca62de0616a7e80fd477a9a3f862ba09d503da188f53ca523"',
'sha256 "e048c5e6144f5932d8672c2fade81d9073d5b3ca1517b84df006de3d25414fc1"',
)
end

it { is_expected.to match("stable sha256 changed without the version also changing") }
end

context "can change with the different version" do
before do
formula_gsub_origin_commit(
Expand Down

0 comments on commit e05b0fc

Please sign in to comment.