-
Notifications
You must be signed in to change notification settings - Fork 0
/
split.sh
executable file
·47 lines (39 loc) · 1.73 KB
/
split.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
set -uxe
if [ $# -ne 2 ]; then
echo "expected two arguments given $#"
exit 1
fi
VCAP_REPO=$1
CLONE_BASE=$2
CLONE_PATH=$(mktemp -d "$CLONE_BASE/vcap.XXX")
SCRIPT_DIR=$(cd $(dirname $0) && pwd)
git clone $VCAP_REPO $CLONE_PATH
cd $CLONE_PATH
for c in router stager; do
git checkout --quiet origin/master
git checkout -b small_$c
git filter-branch -f --prune-empty --subdirectory-filter $c --index-filter "git rm --quiet --cached --ignore-unmatch -r -f vendor/cache"
git push -v git@github.com:d/vcap-$c.git HEAD:master
done
# trim down staging
git checkout --quiet origin/master
git checkout -b small_staging
git filter-branch -f --prune-empty --subdirectory-filter staging --index-filter "git rm --quiet --cached --ignore-unmatch -r -f vcap_staging\*.gem vendor/cache"
git push -v git@github.com:d/vcap-staging.git HEAD:master
# package_cache and friends
git checkout --quiet origin/master
git checkout -b package_cache-and-friends
INDEX_FILTER="git rm -r -f --cached --quiet --ignore-unmatch \$(git ls-tree --name-only \$GIT_COMMIT | egrep -v '^package_cache|package_cache_client|LICENSE|NOTICE|.gitignore' ) \*/vendor/cache/\*"
git filter-branch -f --prune-empty \
--index-filter "$INDEX_FILTER" \
--parent-filter $SCRIPT_DIR/parent-filter.rb
git push -v git@github.com:d/package_cache-and-friends.git HEAD:master
git checkout --quiet origin/master
git checkout -b cchm
INDEX_FILTER="git rm -r -f --cached --quiet --ignore-unmatch \$(git ls-tree --name-only \$GIT_COMMIT | egrep -v '^cloud_controller|health_manager|LICENSE|NOTICE|.gitignore' ) \*/vendor/cache/\*"
git filter-branch -f --prune-empty \
--index-filter "$INDEX_FILTER" \
--parent-filter $SCRIPT_DIR/parent-filter.rb
git push -v git@github.com:d/cchm.git HEAD:master
git branch -v