Only `.diff` URLs return output comparable to the diffs from
`git diff --full-index`. While the extra metadata from `.patch` is
nice, the instability of the patch contents is undesirable.
Co-Authored-By: Carlo Cabrera <30379873+carlocab@users.noreply.github.com>
- The autocorrections here before were leading to changes like:
```
➜ brew style --fix brewsci/science/beetl
Formula/beetl.rb:15:11: C: [Corrected] GitHub patches should use the full_index parameter: https://github.com/BEETL/BEETL/commit/ba47b6f9.patch?full_index=1
url "https://github.com/BEETL/BEETL/commit/ba47b6f9.patch"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
➜ git diff
diff --git a/Formula/beetl.rb b/Formula/beetl.rb
index bbd049aa..7ec6d7bc 100644
--- a/Formula/beetl.rb
+++ b/Formula/beetl.rb
@@ -12,7 +12,7 @@ class Beetl < Formula
# Fixes "error: 'accumulate' is not a member of 'std'"
# Upstream commit "Little fix for compilation on mac"
patch do
- url "https://github.com/BEETL/BEETL/commit/ba47b6f9.patch"
+ url https://github.com/BEETL/BEETL/commit/ba47b6f9.patch?full_index=1
sha256 "63b67f3282893d1f74c66aa98f3bf2684aaba2fa9ce77858427b519f1f02807d"
end
end
```
- This fixes the URLs generated to have quotes:
```
➜ git diff
diff --git a/Formula/beetl.rb b/Formula/beetl.rb
index bbd049aa..7ec6d7bc 100644
--- a/Formula/beetl.rb
+++ b/Formula/beetl.rb
@@ -12,7 +12,7 @@ class Beetl < Formula
# Fixes "error: 'accumulate' is not a member of 'std'"
# Upstream commit "Little fix for compilation on mac"
patch do
- url "https://github.com/BEETL/BEETL/commit/ba47b6f9.patch"
+ url "https://github.com/BEETL/BEETL/commit/ba47b6f9.patch?full_index=1"
sha256 "63b67f3282893d1f74c66aa98f3bf2684aaba2fa9ce77858427b519f1f02807d"
end
end
```
- We recently deleted a load of old Homebrew/formula-patches patches for
non-existent core formulae
(https://github.com/Homebrew/formula-patches/pull/283). This is a good
action to take. Users should always be able to retrieve the patch once
it's been deleted from the repo, if the formula they continue to use
specifies a git revision to pull from, not just `master`.
- The code to detect `master` formulae was already here, so this adds
another GitHub host to the detection: `raw.githubusercontent.com` as
that's what the current patches that use `master`
(https://github.com/Homebrew/homebrew-core/pull/51329) link to.
- Fixes https://github.com/Homebrew/homebrew-core/issues/51313.