#!/bin/bash

set -ex

# version based on current master 3cb3f7ce6bb8b910f5a41ea1887b1faceba6a7d7
# plus pull requests:
# - https://github.com/chrisboulton/php-diff/pull/50
# - https://github.com/chrisboulton/php-diff/pull/51

git clone https://github.com/chrisboulton/php-diff.git

cd php-diff

# master
git checkout 3cb3f7ce6bb8b910f5a41ea1887b1faceba6a7d7

# PR #50
git fetch origin pull/50/head:pr-50
git cherry-pick a9f124f81a9436138879e56157c6cced52a6d95b

# PR #51
git fetch origin pull/51/head:pr-51
git cherry-pick cb0d0781bcc6b0ae39d73715c659a6d2717d28e1

git log -4

rm -rf .git
rm -rf .gitignore
rm -rf composer.json
rm -rf example tests phpunit.xml
cd ..

echo "Now you can run:"
echo "  rsync -av php-diff/ ./ --delete --exclude=SOURCE --exclude=php-diff/"
echo "and:"
echo "  rm -rf php-diff/"
