]> git.scottworley.com Git - pinch/blame_incremental - tests/lib/test-setup.sh
Cache nix store paths of generated tarballs
[pinch] / tests / lib / test-setup.sh
... / ...
CommitLineData
1set -e
2
3cache_dir=$(mktemp -d)
4export XDG_CACHE_HOME=$cache_dir
5
6foo_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]
21git_repo = file://$repo
22git_ref = master
23EOF
24
25}
26
27test_cleanup() {
28 if [ "$repo_dir" ];then rm -rf "$repo_dir"; fi
29 if [ "$conf" ];then rm "$conf"; fi
30 if [ "$cache_dir" ];then rm -rf "$cache_dir"; fi
31}
32
33trap test_cleanup EXIT INT TERM