]> git.scottworley.com Git - pinch/blame - tests/lib/test-setup.sh
Factor out test setup
[pinch] / tests / lib / test-setup.sh
CommitLineData
a2290fb1
SW
1set -e
2
3foo_setup() {
4
5 repo_dir="`mktemp -d`"
6 repo="$repo_dir/repo"
7 git init "$repo"
8 (
9 cd "$repo"
10 echo Contents > test-file
11 git add test-file
12 git commit -m 'Commit message'
13 )
14
15 conf="`mktemp`"
16 cat > "$conf" <<EOF
17[foo]
18git_repo = file://$repo
19git_ref = master
20EOF
21
22}
23
24foo_cleanup() {
25 rm -rf "$repo_dir" "$conf"
26}