]>
Commit | Line | Data |
---|---|---|
a2290fb1 SW |
1 | set -e |
2 | ||
78c89e6e SW |
3 | cache_dir=$(mktemp -d) |
4 | export XDG_CACHE_HOME=$cache_dir | |
5 | ||
a2290fb1 SW |
6 | foo_setup() { |
7 | ||
8 | repo_dir="`mktemp -d`" | |
9 | repo="$repo_dir/repo" | |
10 | git init "$repo" | |
11 | ( | |
12 | cd "$repo" | |
13 | echo Contents > test-file | |
14 | git add test-file | |
15 | git commit -m 'Commit message' | |
16 | ) | |
17 | ||
18 | conf="`mktemp`" | |
19 | cat > "$conf" <<EOF | |
20 | [foo] | |
21 | git_repo = file://$repo | |
22 | git_ref = master | |
23 | EOF | |
24 | ||
25 | } | |
26 | ||
d9a1088a SW |
27 | test_cleanup() { |
28 | if [ "$repo_dir" ];then rm -rf "$repo_dir"; fi | |
29 | if [ "$conf" ];then rm "$conf"; fi | |
78c89e6e | 30 | if [ "$cache_dir" ];then rm -rf "$cache_dir"; fi |
a2290fb1 | 31 | } |
d9a1088a SW |
32 | |
33 | trap test_cleanup EXIT INT TERM |