]> git.scottworley.com Git - pinch/blobdiff - tests/reject-force-push.sh
More tests around rejecting force pushes
[pinch] / tests / reject-force-push.sh
diff --git a/tests/reject-force-push.sh b/tests/reject-force-push.sh
new file mode 100755 (executable)
index 0000000..4a0614f
--- /dev/null
@@ -0,0 +1,26 @@
+#!/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
+