diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 14:17:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 14:17:27 +0000 |
commit | aae1a14ea756102251351d96e2567b4986d30e2b (patch) | |
tree | a1af617672e26aee4c1031a3aa83e8ff08f6a0a5 /t/0-me-first.t | |
parent | Initial commit. (diff) | |
download | gitolite3-aae1a14ea756102251351d96e2567b4986d30e2b.tar.xz gitolite3-aae1a14ea756102251351d96e2567b4986d30e2b.zip |
Adding upstream version 3.6.12.upstream/3.6.12upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-x | t/0-me-first.t | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/t/0-me-first.t b/t/0-me-first.t new file mode 100755 index 0000000..8c9d12b --- /dev/null +++ b/t/0-me-first.t @@ -0,0 +1,94 @@ +#!/usr/bin/perl +use strict; +use warnings; + +# this is hardcoded; change it if needed +use lib "src/lib"; +use Gitolite::Test; + +my $rb = `gitolite query-rc -n GL_REPO_BASE`; + +# initial smoke tests +# ---------------------------------------------------------------------- + +try "plan 71"; + +# basic push admin repo +confreset;confadd ' + repo aa + RW+ = u1 + RW = u2 u3 + + repo cc/..* + C = u4 + RW+ = CREATOR u5 + R = READERS +'; + +try "ADMIN_PUSH set1; !/FATAL/" or die text(); + +try " + /Initialized empty Git repository in .*/aa.git// + + # basic clone + cd .. + glt clone u1 file:///aa u1aa; ok; /Cloning into 'u1aa'.../ + /warning: You appear to have cloned an empty repository/ + [ -d u1aa ]; ok + + # basic clone deny + glt clone u4 file:///aa u4aa; !ok; /R any aa u4 DENIED by fallthru/ + [ -d u4aa ]; !ok + + # basic push + cd u1aa; ok + tc z-507; ok; /master .root-commit. 7cf7624. z-507/ + glt push u1 origin HEAD; ok; /To file:///aa/ + /\\[new branch\\] *HEAD -> master/ + + # basic rewind + tc o-866 o-867 o-868; ok; /master 2d066fb. o-868/ + glt push u1 origin HEAD; ok; /7cf7624..2d066fb HEAD -> master/ + git reset --hard HEAD^; ok; /HEAD is now at 8b1456b o-867/ + tc x-967; ok; /master 284951d. x-967/ + glt push u1 -f origin HEAD; ok; /\\+ 2d066fb...284951d HEAD -> master \\(forced update\\)/ + + # log file + cat \$(gitolite query-rc GL_LOGFILE); + ok; /\tupdate\t/ + /aa\tu1\t\\+\trefs/heads/master/ + /2d066fb4860c29cf321170c17695c6883f3d50e8/ + /284951dfa11d58f99ab76b9f4e4c1ad2f2461236/ + + # basic rewind deny + cd .. + glt clone u2 file:///aa u2aa; ok; /Cloning into 'u2aa'.../ + cd u2aa; ok + tc g-776 g-777 g-778; ok; /master 9cbc181. g-778/ + glt push u2 origin HEAD; ok; /284951d..9cbc181 HEAD -> master/ + git reset --hard HEAD^; ok; /HEAD is now at 2edf7fc g-777/ + tc d-485; ok; /master 1c01d32. d-485/ + glt push u2 -f origin HEAD; !ok; reject + /\\+ refs/heads/master aa u2 DENIED by fallthru/ + + # non-existent repos etc + glt ls-remote u4 file:///bb; !ok; /DENIED by fallthru/ + glt ls-remote u4 file:///cc/1; ok; /Initialized empty/ + glt ls-remote u5 file:///cc/1; ok; perl s/TRACE.*//g; !/\\S/ + glt ls-remote u5 file:///cc/2; !ok; /DENIED by fallthru/ + glt ls-remote u6 file:///cc/2; !ok; /DENIED by fallthru/ + + # command + glt perms u4 -c cc/bar/baz/frob + READERS u2; + ok; /Initialized empty .*cc/bar/baz/frob.git/ + + # path traversal + glt ls-remote u4 file:///cc/dd/../ee + !ok; /FATAL: 'cc/dd/\\.\\./ee' contains '\\.\\.'/ + glt ls-remote u5 file:///cc/../../../../../..$rb/gitolite-admin + !ok; /FATAL: 'cc/../../../../../..$rb/gitolite-admin' contains '\\.\\.'/ + + glt perms u4 -c cc/bar/baz/../frob + READERS u2 + !ok; /FATAL: no relative paths allowed anywhere!/ + +"; |