1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
<!-- -*- markdown -*- -->
Copying repositories on the server-side
=======================================
You may want to copy a repository from one place on the server
to another place on the same server,
since access control is repository based
and another user of the server may want to push their own branches.
This can be accomplished without server-side support by:
1. Creating the destination repository.
2. Cloning the source repository locally.
3. Pushing the local clone to the destination repository.
This requires many round trips
and sending the entire repository's contents across the internet twice,
so there's use for server-side clone operation.
Copying a repository
--------------------
SCENARIO server-side clone
GIVEN a standard instance
Users may copy repositories they can read to paths they can write to.
WHEN testinstance adminkey runs copy gitano-admin public/testrepo
THEN server-side public/testrepo has identical refs to gitano-admin
AND server-side public/testrepo has no missing objects
FINALLY the instance is torn down
Permissions are needed
----------------------
SCENARIO server-side clone failure modes
GIVEN a standard instance
AND testinstance using adminkey has patched gitano-admin with personal-repo-create.patch
AND testinstance, using adminkey, adds a new user alice, with a key called main
WHEN testinstance adminkey runs copy gitano-admin public/testrepo
Users may not copy repositories they can to read to paths they cannot write to.
In the default instance only the admin user may create repositories,
so all copies by other users will fail.
GIVEN testinstance adminkey has set the owner of public/testrepo to alice
WHEN alice main, expecting failure, runs copy public/testrepo personal/testinstance/
THEN stderr contains FATAL: Not authorised
Users may copy repositories where they may write to the destination path,
but will be unable to do so if the repository already exists.
WHEN alice main runs create personal/alice/testrepo
AND alice main, expecting failure, runs copy public/testrepo personal/alice/testrepo
THEN stderr contains ERROR: Repository personal/alice/testrepo already exists
Users may not copy to paths they may not write to
and are not informed if the path already exists if they cannot read it.
WHEN alice main, expecting failure, runs copy user/alice/testrepo gitano-admin
THEN stderr does not contain ERROR: Repository gitano-admin already exists
FINALLY the instance is torn down
|