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