Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
git_stress.sh
#!/bin/bash
# SVN vs Git performance and ease of use
# http://squarism.com/2012/10/12/svn-vs-git-speed
# --------------------
# the git version
function error_mkdir() {
echo "Please give me a base directory to work in. For example: /tmp/stress_test"
exit 1
}
function error_is_not_working_dir() {
echo "$1 is not a directory."
exit 1
}
function error_cleanup() {
echo "Please clean up tmp directories under ${working_dir}."
exit 1
}
if [ ! $1 ]; then
error_mkdir
else
working_dir=$1/git_repo
fi
if [ ! -d ${working_dir} ]; then
mkdir ${working_dir}
fi
cd ${working_dir}
# create the git repo (no server needed)
git init .
# download linux kernel source (79M, ~42,000 files)
if [ ! -f /tmp/linux-3.6.1.tar.bz2 ]; then
wget -O /tmp/linux-3.6.1.tar.bz2 \
http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.6.1.tar.bz2
fi
tar xjf /tmp/linux-3.6.1.tar.bz2
git status
git add linux-3.6.1
git commit -m "initial commit" -a
git checkout -b "ipod_support"
echo -e "Linux kernel release 3.x <http://kernel.org/>\n" > linux-3.6.1/README
echo -e "NOW WITH IPOD SUPPORT" >> linux-3.6.1/README
# git status
# On branch ipod_support
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: linux-3.6.1/README
#
# no changes added to commit (use "git add" and/or "git commit -a")
git commit -m "hacked on ipod support" linux-3.6.1/README
git checkout master
git merge ipod_support
git branch -d ipod_support
# second branching, no comments below for brevity
git checkout -b more_hackery
echo "it was all you" > linux-3.6.1/CREDITS
git commit -m "updated credits" -a
git checkout master
git merge more_hackery
git branch -d more_hackery
# third branch
git checkout -b last_diddy
echo "free as in freedom" > linux-3.6.1/COPYING
git commit -m "updated license" linux-3.6.1/COPYING
git checkout master
git merge last_diddy
git branch -d last_diddy
# cd
# rm -rf ~/tmp/git_stress
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment