summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@gmail.com>2017-04-08 15:37:27 +0100
committerRichard Maw <richard.maw@gmail.com>2017-04-08 15:37:27 +0100
commit903c482b53dbe422ea64f8ae6d22eba0bed5a347 (patch)
tree06dc76b086310929ea33908a3c1a81e9ab118fef
parent14b50b9543181de6bf154dcf0edb385616506bbc (diff)
parentd330a38c84d98b0940487b3334f13894b63dadf5 (diff)
downloadgitano-903c482b53dbe422ea64f8ae6d22eba0bed5a347.tar.gz
Merge remote-tracking branch 'origin/dsilvers/force-push-testing'
-rw-r--r--Makefile2
-rw-r--r--testing/03-force-pushing.yarn34
-rw-r--r--testing/library.yarn6
3 files changed, 39 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index c85383a..d7b0614 100644
--- a/Makefile
+++ b/Makefile
@@ -39,7 +39,7 @@ TESTS := 01-basics 02-commands-as 02-commands-config 02-commands-copy \
02-commands-keyring \
02-commands-ls 02-commands-rename 02-commands-rsync \
02-commands-sshkey 02-commands-user 02-commands-whoami 03-cgit-support \
- 03-shallow-push 03-treedelta-rules
+ 03-shallow-push 03-treedelta-rules 03-force-pushing
MODS := gitano \
diff --git a/testing/03-force-pushing.yarn b/testing/03-force-pushing.yarn
new file mode 100644
index 0000000..5d8e98a
--- /dev/null
+++ b/testing/03-force-pushing.yarn
@@ -0,0 +1,34 @@
+<!-- -*- Markdown -*- -->
+
+Force Pushing
+=============
+
+The default ruleset of Gitano denies force-pushing to everyone except the
+`gitano-admin` group by default; requiring that projects explicitly enable it
+if they want it. The theory being that it can be permitted for some branches
+but not others, and by deny-by-default, it encourages project owners to think
+hard before granting force-push.
+
+ SCENARIO alice cannot force-push by default
+
+ GIVEN a standard instance
+ AND a unix user called alice
+ AND alice has keys called main
+
+ WHEN testinstance, using adminkey, adds user alice, using alice main
+ AND testinstance adminkey runs create testrepo alice
+ AND alice, using main, clones testrepo as testrepo
+ THEN alice testrepo has no file called FOO
+
+ WHEN alice applies add-a-FOO.patch in testrepo
+ AND alice, using main, pushes testrepo to testrepo.git
+ THEN the output contains new branch
+
+ WHEN alice amends testrepo with oh well never mind
+ AND alice, using main, expecting failure, pushes testrepo to testrepo.git
+ THEN the output contains non-fast-forward
+
+ WHEN alice, using main, expecting failure, force-pushes testrepo to testrepo.git
+ THEN stderr contains denied action
+
+ FINALLY the instance is torn down
diff --git a/testing/library.yarn b/testing/library.yarn
index 5547faf..6facf2a 100644
--- a/testing/library.yarn
+++ b/testing/library.yarn
@@ -75,8 +75,8 @@ Repository access
$GTT clone "$MATCH_1" "$MATCH_2" "$MATCH_3" "$MATCH_4" ${MATCH_5:+ --no-local --depth="$MATCH_6"} \
>"$DATADIR/stdout" 2>"$DATADIR/stderr"
- IMPLEMENTS WHEN ([a-z][a-z0-9]*),? using ([a-z][a-z0-9]*),? (expecting failure,? )?pushes ([^ ]+) to ([^ ]+)
- if $GTT push "$MATCH_1" "$MATCH_2" "$MATCH_4" "$MATCH_5" \
+ IMPLEMENTS WHEN ([a-z][a-z0-9]*),? using ([a-z][a-z0-9]*),? (expecting failure,? )?(force.)?pushes ([^ ]+) to ([^ ]+)
+ if $GTT push "$MATCH_1" "$MATCH_2" "$MATCH_5" "$MATCH_6" ${MATCH_4:+--force} \
>"$DATADIR/stdout" 2>"$DATADIR/stderr"; then
test "$MATCH_3" = ""
fi
@@ -198,6 +198,8 @@ Admin repo manipulation
$GTT rungit "$MATCH_1" "$MATCH_4" commit --allow-empty -m "Apply $MATCH_3 content change" \
>>"$DATADIR/stdout" 2>>"$DATADIR/stderr"
+ IMPLEMENTS WHEN ([a-z][a-z0-9]*) amends ([^ ]+) with (.+)
+ $GTT rungit "$MATCH_1" "$MATCH_2" commit --amend -m "$MATCH_3"
Specific commands
-----------------