X-Git-Url: http://git.scottworley.com/pinch/blobdiff_plain/001b650db2f8a9e141634d63fa89250c1088f3c2..db3da89c7a9f14eec5aa400acfd3c888daca8385:/tests/reject-nonancestor.sh?ds=inline diff --git a/tests/reject-nonancestor.sh b/tests/reject-nonancestor.sh new file mode 100755 index 0000000..b8e944a --- /dev/null +++ b/tests/reject-nonancestor.sh @@ -0,0 +1,38 @@ +#!/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" < 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"