Skip to content

Instantly share code, notes, and snippets.

@waffle2k
Last active December 21, 2015 12:49
Show Gist options
  • Save waffle2k/6308365 to your computer and use it in GitHub Desktop.
Save waffle2k/6308365 to your computer and use it in GitHub Desktop.
Github used to limit the number of public repos. As such, I had all of my CPAN modules as subdirectories of a single repo. This script iterates through those directories and imports the directory into the new repo after renaming the repo to match the Debian perl module package naming.
#!/bin/bash
#
# from https://help.github.com/articles/splitting-a-subpath-out-into-a-new-repository
#
for CHILD in Conan Copy-From-Git Net-Domain-Regex Net-Domain-Match Net-PortTest
do
cd /tmp
rm -rf /tmp/Perl-CPAN
git clone [email protected]:petermblair/Perl-CPAN.git && cd Perl-CPAN
git filter-branch --prune-empty --subdirectory-filter $CHILD master
NEWNAME=$(printf "libperl-%s\n" $( echo $CHILD | tr [:upper:] [:lower:] ) )
#git remote add origin [email protected]:petermblair/${NEWNAME}.git
# [email protected]:petermblair/Perl-CPAN.git
perl -p -i -e "s/Perl-CPAN.git/${NEWNAME}.git/g" .git/config
git push -u origin master
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment