Skip to content

Instantly share code, notes, and snippets.

@azatoth
Created March 10, 2011 22:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save azatoth/865120 to your computer and use it in GitHub Desktop.
Save azatoth/865120 to your computer and use it in GitHub Desktop.
Splits the github mediawiki extension copy repository into one repo per extension
#!/bin/bash
# This script takes the mediawiki trunk extension git repository and splits them into one
# repository for each extension
#
# Warning: this can take some time
#
# Specify the path to your copy of the extension repo below:
MW_EXT_GIT=$HOME/public_html/mediawiki-trunk-extensions
for module in $(find $MW_EXT_GIT/* -maxdepth 0 -type d -exec basename {} \;); do
tmpdir=$(mktemp -d --tmpdir=$PWD); # should be same device due to hardlinks
git clone $MW_EXT_GIT $tmpdir;
cd $tmpdir;
git filter-branch \
--prune-empty \
--subdirectory-filter $module \
--msg-filter 'sed -e "/^git-svn-id:/d"' \
HEAD;
cd ..;
git clone file://$tmpdir $module;
cd $module;
git remote rm origin;
git gc --aggressive --prune=now;
cd ..;
rm -rf $tmpdir;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment