]> git.scottworley.com Git - pinch/blame_incremental - tests/reject-nonancestor.sh
shell.nix
[pinch] / tests / reject-nonancestor.sh
... / ...
CommitLineData
1#!/bin/sh
2
3set -e
4
5repo_dir="`mktemp -d`"
6repo="$repo_dir/repo"
7git init "$repo"
8(
9 cd "$repo"
10 echo Contents > test-file
11 git add test-file
12 git commit -m 'Commit message'
13)
14
15conf="`mktemp`"
16cat > "$conf" <<EOF
17[foo]
18git_repo = file://$repo
19git_ref = master
20EOF
21
22python3 ./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
31if python3 ./pinch.py pin "$conf";then
32 echo "FAIL: non-ancestor commit should be rejected"
33 exit 1
34else
35 echo PASS
36fi
37
38rm -rf "$repo_dir" "$conf"