Skip to content

Instantly share code, notes, and snippets.

@eddiemoya
Created March 27, 2013 17:07
Show Gist options
  • Save eddiemoya/5256085 to your computer and use it in GitHub Desktop.
Save eddiemoya/5256085 to your computer and use it in GitHub Desktop.
#!/bin/bash
SYNC_BIN_PATH=`dirname $(readlink -f $0)`
TMP_PATH="$SYNC_BIN_PATH/tmp"
REPO_PLUGINS="$SYNC_BIN_PATH/uxwpress/plugins/*"
NEW_REPO_PLUGINS="$SYNC_BIN_PATH/plugins"
for i in $REPO_PLUGINS
do
CURRENT_PLUGIN_NAME=`basename "$i"`
cd "$i"
rm -rf "$TMP_PATH/$CURRENT_PLUGIN_NAME"
mkdir "$TMP_PATH/$CURRENT_PLUGIN_NAME"
git format-patch -o "$TMP_PATH/$CURRENT_PLUGIN_NAME" \
$(git log "$i"|grep ^commit|tail -1|awk '{print $2}')^..HEAD \
"$i"
rm -rf "$NEW_REPO_PLUGINS/$CURRENT_PLUGIN_NAME"
mkdir "$NEW_REPO_PLUGINS/$CURRENT_PLUGIN_NAME"
cd "$NEW_REPO_PLUGINS/$CURRENT_PLUGIN_NAME"
git init
git am "$TMP_PATH/$CURRENT_PLUGIN_NAME/"*.patch
git mv plugins/$CURRENT_PLUGIN_NAME/* ./
git commit -a -m "Moving plugin to root of repo."
rm -rf ./plugins
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment