Created
August 12, 2020 16:44
Star
You must be signed in to star a gist
Generates the diff between Composer autload files from a pull request
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -eu | |
if [ $# -ne 1 ]; then | |
echo "Usage: `basename $0` <pull>"; | |
exit 1; | |
fi | |
PULL="$1" | |
rm -rf /tmp/composer | |
mkdir -p /tmp/composer/{base,head} | |
git fetch -f upstream "pull/$PULL/head:pull/$PULL" | |
git checkout "pull/$PULL" | |
composer install --no-dev --optimize-autoloader | |
cp vendor/composer/autoload_*.php /tmp/composer/head/ | |
# https://stackoverflow.com/a/30563070/146187 | |
MERGE_BASE=$(diff -u \ | |
<(git rev-list --first-parent upstream/master) \ | |
<(git rev-list --first-parent HEAD) \ | |
| sed -ne "s/^ //p" \ | |
| head -1 | |
) | |
git checkout "$MERGE_BASE" | |
composer install --no-dev --optimize-autoloader | |
cp vendor/composer/autoload_*.php /tmp/composer/base/ | |
diff -ru /tmp/composer/{base,head} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment