File tree Expand file tree Collapse file tree 5 files changed +75
-3
lines changed Expand file tree Collapse file tree 5 files changed +75
-3
lines changed Original file line number Diff line number Diff line change @@ -21,9 +21,27 @@ second argument:
21
21
22
22
.. code-block :: php
23
23
24
- $repository = Gitonomy\Git\Admin::init('/path/to/folder', false);
24
+ $repository = Gitonomy\Git\Admin::init('/tmp/git_sandbox', false);
25
+
26
+ Cloning repositories
27
+ ::::::::::::::::::::
28
+
29
+ You can clone a repository from an URL by doing:
30
+
31
+ .. code-block :: php
32
+
33
+ $repository = Gitonomy\Git\Admin::cloneTo('/tmp/gitlib', 'https://github.com/gitonomy/gitlib.git');
34
+
35
+ You can pass ``false `` and third argument to get a repository with a working copy.
36
+
37
+ If you already have a Repository instance and want to clone it, you can use this shortcut:
38
+
39
+ .. code-block :: php
40
+
41
+ $new = $repository->cloneTo('/tmp/clone');
25
42
26
43
References
27
44
::::::::::
28
45
29
- - http://linux.die.net/man/1/git-init
46
+ * http://linux.die.net/man/1/git-init
47
+ * http://linux.die.net/man/1/git-clone
Original file line number Diff line number Diff line change
1
+ Developing gitlib
2
+ =================
3
+
4
+ If you plan to contribute to gitlib, here are few things you should know:
5
+
6
+ Documentation generation
7
+ ::::::::::::::::::::::::
8
+
9
+ Documentation is generated using Sphinx (restructured text). Configuration file
10
+ is located in https://github.com/gitonomy/website/blob/master/bin/conf.py
11
+
12
+ You will need to fetch vendor modules for PHP blocks especially. If you really
13
+ want to generate it, install the website project locally and hack into it.
Original file line number Diff line number Diff line change @@ -33,7 +33,6 @@ Missing features
33
33
Some major features are still missing from gitlib:
34
34
35
35
* Remotes
36
- * Clone
37
36
* Submodules
38
37
39
38
If you want to run git commands on repository, call method ``Repository::run `` with method and arguments.
Original file line number Diff line number Diff line change
1
+ Installation of gitlib
2
+ ======================
3
+
4
+ Autoloading
5
+ :::::::::::
6
+
7
+ gitlib relies on class autoloading. It does not require any additional setup.
8
+
9
+ Using composer
10
+ ::::::::::::::
11
+
12
+ Edit your ``composer.json `` file and add ``gitonomy/gitlib `` in section ``require ``:
13
+
14
+ .. code-block :: json
15
+
16
+ {
17
+ "require" : {
18
+ "gitonomy/gitlib" : " dev-master"
19
+ }
20
+ }
Original file line number Diff line number Diff line change @@ -55,6 +55,28 @@ public function testNotBare()
55
55
$ this ->assertEquals ($ this ->tmpDir , $ repository ->getWorkingDir (), "working dir present in bare repository " );
56
56
}
57
57
58
+ /**
59
+ * @dataProvider provideFoobar
60
+ */
61
+ public function testClone ($ repository )
62
+ {
63
+ $ newDir = self ::createTempDir ();
64
+ $ new = $ repository ->cloneTo ($ newDir , $ repository ->isBare ());
65
+ self ::registerDeletion ($ new );
66
+
67
+ $ oldRefs = $ repository ->getReferences ()->getAll ();
68
+ $ newRefs = $ new ->getReferences ()->getAll ();
69
+
70
+ $ this ->assertEquals (array_keys ($ oldRefs ), array_keys ($ newRefs ), "same references in both repositories " );
71
+
72
+ if ($ repository ->isBare ()) {
73
+ $ this ->assertEquals ($ newDir , $ new ->getGitDir ());
74
+ } else {
75
+ $ this ->assertEquals ($ newDir .'/.git ' , $ new ->getGitDir ());
76
+ $ this ->assertEquals ($ newDir , $ new ->getWorkingDir ());
77
+ }
78
+ }
79
+
58
80
/**
59
81
* @expectedException RuntimeException
60
82
*/
You can’t perform that action at this time.
0 commit comments