--- /dev/null
+#!/bin/sh
+
+set -e
+
+repo_dir="`mktemp -d`"
+repo="$repo_dir/repo"
+git init "$repo"
+(
+ cd "$repo"
+ echo Contents > test-file
+ git add test-file
+ git commit -m 'Commit message'
+)
+
+conf="`mktemp`"
+cat > "$conf" <<EOF
+[foo]
+git_repo = file://$repo
+git_ref = master
+EOF
+
+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
+
+rm -rf "$repo_dir" "$conf"