Last active
August 29, 2015 13:57
-
-
Save nh2/9902001 to your computer and use it in GitHub Desktop.
Generates a git repository with dual history and some branches on top (for fixing a Jenkins performance bug)
This file contains hidden or 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 | |
# Creates a git repository called "testgit-generated" | |
# with two separate histories branching from the initial | |
# commit, each being 500 commits long. | |
# On top of each, we create 200 branches with one extra | |
# commit per branch. | |
# Should take around 30 seconds. | |
set -e | |
# Create repo | |
mkdir testgit-generated | |
cd testgit-generated | |
echo start > myfile | |
git init | |
git add myfile | |
git commit -m "Initial commit" | |
git branch init | |
# Create history 1 (500 commits) | |
git checkout -b history1 init | |
for i in {1..500}; do | |
echo "commit $i" | |
date +%s%N >> myfile | |
git commit -am "`date +%s%N`" | |
done | |
# Create 200 branches on top of history 1 | |
for i in {1..200}; do | |
echo "branch $i" | |
git reset --hard | |
git checkout -f -b `date +%s%N` history1 | |
date +%s%N >> myfile | |
git commit -am "`date +%s%N`" | |
done | |
# Create history 2 (500 commits) | |
git checkout -b history2 init | |
for i in {1..500}; do | |
echo "commit $i" | |
date +%s%N >> myfile | |
git commit -am "`date +%s%N`" | |
done | |
# Create 200 branches on top of history 2 | |
for i in {1..200}; do | |
echo "branch $i" | |
git reset --hard | |
git checkout -f -b `date +%s%N` history2 | |
date +%s%N >> myfile | |
git commit -am "`date +%s%N`" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment