Last active
March 15, 2017 09:24
-
-
Save Elzair/a86b0cf28061c872b70508f948946e15 to your computer and use it in GitHub Desktop.
Unvanquished history merge
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
#!/bin/sh | |
PWD=$(pwd) | |
FORK_COMMIT="ca388dc0c6bac110254a4e5a175abbb7963b1f4f" | |
FORK_DATE="Wed Jul 15 22:04:42 2015 +100" | |
if [ ! -d "Unvanquished" ] | |
then | |
echo -e "Cloning full repository" | |
git clone https://github.com/Unvanquished/Unvanquished.git Unvanquished | |
fi | |
echo -e "\nCreating repository for all commits before daemon split" | |
git clone Unvanquished daemon-engine | |
echo -e "\nCreate repository for all commits after daemon split" | |
git clone Unvanquished tmp | |
echo -e "\nMoving to Old commits" | |
cd daemon-engine | |
#echo -e "\nResetting to commit before engine was factored into daemon codebase" | |
#git reset --hard "$FORK_COMMIT" | |
echo -e "\nFiltering out anything unrelated to src/ subdirectory" | |
git filter-branch -f --prune-empty --subdirectory-filter src/ --tag-name-filter cat -- --all | |
echo -e "\nFiltering out game code" | |
git filter-branch -f --prune-empty --index-filter 'git rm --cached -r -q -- . ; git reset -q $GIT_COMMIT -- common/ engine/ libs/crunch/ libs/detour/ libs/fastlz/ libs/findlocale/ libs/minizip libs/nacl libs/openexr libs/pdcurses/ libs/recast/ libs/tinyformat/ libs/tinygettext/ utils/' --tag-name-filter cat -- --all | |
echo -e "\nAdding necessary submodules" | |
git submodule add https://github.com/Unvanquished/breakpad.git libs/breakpad | |
git submodule add https://github.com/Unvanquished/recastnavigation.git libs/recastnavigation | |
git submodule add https://github.com/DaemonDevelopers/CBSE-Toolchain.git utils/cbse | |
GIT_AUTHOR_DATE="$FORK_DATE" GIT_COMMITTER_DATE="$FORK_DATE" git commit -m "Adding necessary submodules for future commits" | |
echo -e "\nMoving to New commits" | |
cd ../tmp | |
echo -e "\nFiltering out everything not belonging to engine subdirectory" | |
git filter-branch -f --prune-empty --subdirectory-filter daemon/ --tag-name-filter cat -- --all | |
echo -e "\nAdding new commits to old" | |
cd ../daemon-engine | |
git remote add new-changes ../tmp | |
git fetch new-changes | |
git merge new-changes/master -X theirs --allow-unrelated-histories -m "Stitching together engine history" | |
echo -e "\nResetting GIT_COMMITTER_DATE" | |
git filter-branch --env-filter 'GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE' -- --all | |
echo -e "\nRemoving garbage" | |
git gc | |
echo -e "\nPushing engine repository to Github" | |
git remote rm new-changes | |
git remote rm origin | |
git remote add origin git@github.com:Elzair/daemon-engine.git | |
git push -u origin master | |
echo -e "\nRemoving temporary repository" | |
cd .. | |
rm -rf tmp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment