From e48c155f42adeb98b2c6d793e3b2e125d7c2effe Mon Sep 17 00:00:00 2001 From: apainintheneck Date: Tue, 17 Oct 2023 22:41:50 -0700 Subject: [PATCH] dev-cmd/unbottled: share common parts of bottle tag regex 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. --- Library/Homebrew/dev-cmd/unbottled.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/dev-cmd/unbottled.rb b/Library/Homebrew/dev-cmd/unbottled.rb index 3675a1b7b7..7c0d480c2a 100644 --- a/Library/Homebrew/dev-cmd/unbottled.rb +++ b/Library/Homebrew/dev-cmd/unbottled.rb @@ -260,12 +260,14 @@ module Homebrew def output_lost_bottles ohai ":#{@bottle_tag} lost bottles" - # $ git log --patch -G'^ +sha256.* sonoma:' --since=@{'1 week ago'} + bottle_tag_regex_fragment = " +sha256.* #{@bottle_tag}: " + + # $ 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'}" - bottle_tag_sha_regex = /^[+-] +sha256.* #{@bottle_tag}: / + bottle_tag_sha_regex = /^[+-]#{bottle_tag_regex_fragment}/ processed_formulae = Set.new commit = T.let(nil, T.nilable(String))