Skip to content

Commit

Permalink
Better detection of patches - they don't all end in .patch
Browse files Browse the repository at this point in the history
- Check for which patches are in use in `homebrew-core`, trimming the quotes and only getting the last part of the path.
- Get all the patches in this repository.
- Compare the two and print out the missing ones in the `homebrew-core` repository.
- Add a TODO for deleting the unused patches, it might be nice for this workflow to do that once we know it's legit.
  • Loading branch information
issyl0 committed Feb 11, 2024
1 parent 8a5b37b commit b642b46
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/check-reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,16 @@ jobs:

- name: Detect references
run: |
patches=$(find -name "*.patch" -printf "%f\n")
#!/bin/bash
core_patches=$(git -C homebrew-core grep -h "Homebrew/formula-patches" | awk -F/ '{print $NF}' | tr -d '"')
all_patches=$(git ls-files | grep -v "LICENSE" | grep -v "README.md" | grep -v ".github/workflows/triage-issues.yml" | grep -v ".github/workflows/check-reference.yml")
status=0
for patch in $patches; do
if ! git -C "homebrew-core" grep -r "${patch/./}" > /dev/null; then
echo "$patch not needed!"
for patch in $all_patches; do
if ! grep -q "$core_patches" <<< "$patch"; then
echo "Unused patch: $patch."
# TODO: Delete the patch and commit the deletion.
status=1
fi
done
Expand Down

0 comments on commit b642b46

Please sign in to comment.