mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00

`Livecheck#preprocess_url` only contains logic for rewriting Git URLs, so it makes more sense for this code to be part of the `Git` strategy instead. Outside of better code organization, this saves us from having to maintain the list of strategies to skip processing (which is sometimes forgotten when a new strategy is added) and makes it easier to do something similar in other strategies as needed. One thing to note is that `Livecheck#preprocess_url` was previously called on the URL before each strategy's `#match?` method was called. To maintain the existing behavior, this calls `Git#preprocess_url` in `Git#match?`. However, we need the processed URL when we use the `Git` strategy, so we have to call `Git#preprocess_url` again. To avoid duplicating effort, I've added a `@processed_urls` hash to the `Git` strategy and have set up `Git#preprocess_url` to cache processed URLs, so we only do the work once. There may be a better way of handling it but this seems to work as expected.