]> git.scottworley.com Git - pinch/blob - tests/reject-nonancestor.sh
More tests: pin-twice, reject-nonancestor
[pinch] / tests / reject-nonancestor.sh
1 #!/bin/sh
2
3 set -e
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]
18 git_repo = file://$repo
19 git_ref = master
20 EOF
21
22 python3 ./pinch.py pin "$conf"
23
24 (
25 cd "$repo"
26 echo Other contents > other-file
27 git add other-file
28 git commit --amend -m 'Amended commit message'
29 )
30
31 if python3 ./pinch.py pin "$conf";then
32 echo "FAIL: non-ancestor commit should be rejected"
33 exit 1
34 else
35 echo PASS
36 fi
37
38 rm -rf "$repo_dir" "$conf"