Created
October 28, 2019 02:48
-
-
Save paul-chambers/cc0277b74487c41513eb9d477705f34f to your computer and use it in GitHub Desktop.
Short script to split the miniupnp/miniupnp repo into three - miniupnpc, miniupnpd, and minissdpd
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/bash | |
set -x | |
USER=miniupnp | |
PROJECT=miniupnp | |
repo=https://github.com/${USER}/${PROJECT}.git | |
if [ -d "${PROJECT}" ]; then | |
rm -rf "${PROJECT}" | |
fi | |
git clone "${repo}" | |
mkdir -p root-files | |
find "${PROJECT}/" -maxdepth 1 -type f -exec cp -av "{}" root-files/ ';' | |
USER=paul-chambers | |
for subdir in miniupnpd minissdpd miniupnpc | |
do | |
if [ -d "${subdir}" ]; then | |
rm -rf "${subdir}" | |
fi | |
git clone --local "${PROJECT}/" "${subdir}" | |
cd "${subdir}" | |
git remote set-url origin "[email protected]:${USER}/${subdir}.git" | |
otherTags=$(git tag --list | sed -e "/^${subdir}.*/ d") | |
git tag -d ${otherTags} | |
if [ "${subdir}" == "miniupnpc" ]; then | |
git filter-branch --index-filter 'git rm --cached -qr --ignore-unmatch -- minissdpd miniupnpd' --prune-empty -- --all | |
else | |
git filter-branch -d "/tmp/${subdir}" --prune-empty --tag-name-filter "cat" --subdirectory-filter "${subdir}/" -- --all | |
cp -vn ../root-files/* ../root-files/.??* . | |
git add . && git commit -m "add back the top-level files" | |
fi | |
git repack -ad | |
cd .. | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment