--- /dev/null
+#!/bin/sh
+
+. ./tests/lib/test-setup.sh
+
+foo_setup
+
+python3 ./pinch.py pin "$conf"
+
+(
+ cd "$repo"
+ echo Other contents > other-file
+ git add other-file
+ git commit --amend -m 'Amended commit message'
+)
+
+if python3 ./pinch.py pin "$conf";then
+ echo "FAIL: non-ancestor commit should be rejected"
+ exit 1
+else
+ echo PASS
+fi
--- /dev/null
+#!/bin/sh
+
+. ./tests/lib/test-setup.sh
+
+foo_setup
+conf_bak=$(mktemp)
+cp "$conf" "$conf_bak"
+
+python3 ./pinch.py pin "$conf"
+
+(
+ cd "$repo"
+ echo Other contents > other-file
+ git add other-file
+ git commit --amend -m 'Amended commit message'
+)
+
+mv "$conf_bak" "$conf"
+
+if python3 ./pinch.py pin "$conf";then
+ echo "FAIL: non-ancestor commit should be rejected"
+ exit 1
+else
+ echo PASS
+fi
+
git commit --amend -m 'Amended commit message'
)
+rm -rf "$cache_dir"/*
+
if python3 ./pinch.py pin "$conf";then
echo "FAIL: non-ancestor commit should be rejected"
exit 1
--- /dev/null
+#!/bin/sh
+
+. ./tests/lib/test-setup.sh
+
+foo_setup
+
+(
+ cd "$repo"
+ git checkout -b historical
+ git checkout master
+ echo Other contents > other-file
+ git add other-file
+ git commit -m 'Second commit message'
+)
+
+python3 ./pinch.py pin "$conf"
+
+sed -i 's/master/historical/' "$conf"
+
+if python3 ./pinch.py pin "$conf";then
+ echo "FAIL: non-ancestor commit should be rejected"
+ exit 1
+else
+ echo PASS
+fi