Skip to content

Commit

Permalink
dev-cmd/unbottled: share common parts of bottle tag regex
Browse files Browse the repository at this point in the history
This makes it easier to see that the two regexes are related
and could make it easier to change them in the future if
need be.
  • Loading branch information
apainintheneck committed Oct 18, 2023
1 parent 83598bb commit e48c155
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Library/Homebrew/dev-cmd/unbottled.rb
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,14 @@ def output_unbottled(formulae, deps_hash, noun, hash, any_named_args)
def output_lost_bottles
ohai ":#{@bottle_tag} lost bottles"

Check warning on line 261 in Library/Homebrew/dev-cmd/unbottled.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/dev-cmd/unbottled.rb#L261

Added line #L261 was not covered by tests

# $ git log --patch -G'^ +sha256.* sonoma:' --since=@{'1 week ago'}
bottle_tag_regex_fragment = " +sha256.* #{@bottle_tag}: "

Check warning on line 263 in Library/Homebrew/dev-cmd/unbottled.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/dev-cmd/unbottled.rb#L263

Added line #L263 was not covered by tests

# $ git log --patch --no-ext-diff -G'^ +sha256.* sonoma:' --since=@{'1 week ago'}
git_log = %w[git log --patch --no-ext-diff]
git_log << "-G^ +sha256.* #{@bottle_tag}:"
git_log << "-G^#{bottle_tag_regex_fragment}"
git_log << "--since=@{'1 week ago'}"

Check warning on line 268 in Library/Homebrew/dev-cmd/unbottled.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/dev-cmd/unbottled.rb#L266-L268

Added lines #L266 - L268 were not covered by tests

bottle_tag_sha_regex = /^[+-] +sha256.* #{@bottle_tag}: /
bottle_tag_sha_regex = /^[+-]#{bottle_tag_regex_fragment}/

Check warning on line 270 in Library/Homebrew/dev-cmd/unbottled.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/dev-cmd/unbottled.rb#L270

Added line #L270 was not covered by tests

processed_formulae = Set.new
commit = T.let(nil, T.nilable(String))
Expand Down

0 comments on commit e48c155

Please sign in to comment.