1
1
# USING THE GIT REPOSITORY
2
2
3
- ## Initial Setup
4
-
5
- First, make sure you know the email address associated with your JIRA
6
- credentials. All commits pushed to the master repository are checked
7
- against these addresses, so your repository will need to be configured
8
- to use that address. The following will give you that information:
9
-
10
- 1 . Visit the ZF Crowd install: http://framework.zend.com/crowd
11
- 2 . Log in, if you aren't.
12
- 3 . Find the "My Profile" link in the upper right of the page, and follow
13
- it.
14
- 4 . The resulting page will display your profile, including the _ email_
15
- address with which you are registered. Make a note of it.
16
-
17
3
## Setup your own public repository
18
4
19
- Your next step is to establish a public repository from which we can
5
+ Your first step is to establish a public repository from which we can
20
6
pull your work into the master repository. You have two options: use
21
7
github or other public site, or setup/use your own repository.
22
8
9
+ While you can use a private repository and utilize `` git format-patch `` to
10
+ submit patches, this is discouraged as it does not facilitate public peer
11
+ review.
12
+
23
13
### Option 1: GitHub
24
14
25
15
1 . Setup a GitHub account (http://github.com/ ), if you haven't yet
@@ -32,14 +22,7 @@ github or other public site, or setup/use your own repository.
32
22
% cd zf2
33
23
```
34
24
35
- 4. Configure git to use the email address with which you are registered
36
- in JIRA:
37
-
38
- ` ` ` sh
39
- % git config user.email < your email address>
40
- ` ` `
41
-
42
- 5. Add a remote to the canonical ZF repository, so you can keep your fork
25
+ 4. Add a remote to the canonical ZF repository, so you can keep your fork
43
26
up-to-date:
44
27
45
28
` ` ` sh
@@ -49,10 +32,10 @@ github or other public site, or setup/use your own repository.
49
32
50
33
# ## Option 2: Personal Repository
51
34
52
- We assume you will use gitosis (http://progit.org /book/ch4-7.html) or gitolite
53
- (http://progit.org /book/ch4-8.html ) to host your own repository. If
54
- you go this route, we will assume you have the knowledge to do so, or
55
- know where to obtain it. We will not assist you in setting up such a
35
+ We assume you will use gitosis (http://git-scm.com /book/en/Git-on-the-Server-Gitosis)
36
+ or gitolite (http://git-scm.com /book/en/Git-on-the-Server-Gitolite ) to host your
37
+ own repository. If you go this route, we will assume you have the knowledge to
38
+ do so, or know where to obtain it. We will not assist you in setting up such a
56
39
repository.
57
40
58
41
1. Create a new repository
@@ -61,33 +44,26 @@ repository.
61
44
% git init
62
45
` ` `
63
46
64
- 2. Configure git to use the email address with which you are registered
65
- in JIRA:
66
-
67
- ` ` ` sh
68
- % git config user.email < your email address>
69
- ` ` `
70
-
71
- 3. Add an " origin" remote pointing to your gitosis/gitolite repo:
47
+ 2. Add an " origin" remote pointing to your gitosis/gitolite repo:
72
48
73
49
` ` ` sh
74
50
% git remote add origin git://yourdomain/yourrepo.git
75
51
` ` `
76
52
77
- 4 . Add a remote for the ZF repository and fetch it
53
+ 3 . Add a remote for the ZF repository and fetch it
78
54
79
55
` ` ` sh
80
56
% git remote add zf2 https://github.com/zendframework/zf2.git
81
57
% git fetch zf2
82
58
` ` `
83
59
84
- 5 . Create a new branch for the ZF repository (named " zf/master" here)
60
+ 4 . Create a new branch for the ZF repository (named " zf/master" here)
85
61
86
62
` ` ` sh
87
63
% git checkout -b zf/master zf2/master
88
64
` ` `
89
65
90
- 6 . Create your master branch off the ZF branch, and push to your
66
+ 5 . Create your master branch off the ZF branch, and push to your
91
67
repository
92
68
93
69
` ` ` sh
@@ -100,29 +76,80 @@ repository.
100
76
The ZF2 Travis-CI will confirm that code style standards are met
101
77
by using ` ` ` php-cs-fixer` ` ` (https://github.com/fabpot/PHP-CS-Fixer) during it' s build runs.
102
78
103
- To reduce the number of red Travis-CI builds, the following Git pre-commit hook can help catch code style
104
- issues before committing.
79
+ To reduce the number of red Travis-CI builds, the following Git pre-commit hook
80
+ can help catch code style issues before committing. Save it as
81
+ ```.git/hooks/pre-commit```, and make sure it is executable.
105
82
106
83
```sh
107
- #!/bin/sh
108
- # Git pre-commit hook to confirm ZF2 code style
109
- # Install under: zf2/.git/hooks/pre-commit (and ensure it is executable)
110
-
111
- PROJECTROOT=`echo $(cd ${0%/*}/../../ && pwd -P)`/
112
- FIXER=php-cs-fixer
113
-
114
- RES=`${FIXER} fix $PROJECTROOT -v --dry-run --level=psr2`
115
- if [ "$RES" != "" ]; then
116
- echo "ZF2 Coding standards are not correct, cancelling your commit."
117
- echo ""
118
- echo $RES
119
- echo ""
120
- echo "To fix, run:"
121
- echo ""
122
- echo " ${FIXER} fix ${PROJECTROOT} -v --level=psr2"
123
- echo ""
124
- exit 1
125
- fi
84
+ #!/usr/bin/env php
85
+ <?php
86
+ /**
87
+ * .git/hooks/pre-commit
88
+ *
89
+ * This pre-commit hooks will check for PHP errors (lint), and make sure the
90
+ * code is PSR-2 compliant.
91
+ *
92
+ * Dependecy: PHP-CS-Fixer (https://github.com/fabpot/PHP-CS-Fixer)
93
+ *
94
+ * @author Mardix http://github.com/mardix
95
+ * @author Matthew Weier O' Phinney http://mwop.net/
96
+ * @since 4 Sept 2012
97
+ * /
98
+
99
+ $exit = 0;
100
+
101
+ /*
102
+ * collect all files which have been added, copied or
103
+ * modified and store them in an array called output
104
+ * /
105
+ $output = array ();
106
+ exec(' git diff --cached --name-status --diff-filter=ACM' , $output );
107
+
108
+ foreach ($output as $file ) {
109
+ if (' D' === substr($file , 0, 1)) {
110
+ // deleted file; do nothing
111
+ continue ;
112
+ }
113
+
114
+ $fileName = trim(substr($file , 1));
115
+
116
+ /*
117
+ * Only PHP files
118
+ * /
119
+ $extension = pathinfo($fileName , PATHINFO_EXTENSION);
120
+ if (! preg_match(' /^ph(p|tml)$/' , $extension )) {
121
+ continue ;
122
+ }
123
+
124
+ /*
125
+ * Check for parse errors
126
+ * /
127
+ $output = array ();
128
+ $return = 0;
129
+ exec(" php -l " . escapeshellarg($fileName ), $output , $return );
130
+
131
+ if ($return ! = 0) {
132
+ echo " PHP file fails to parse: " . $fileName . " :" . PHP_EOL;
133
+ echo implode(PHP_EOL, $lintOutput ) . PHP_EOL;
134
+ $exit = 1;
135
+ continue ;
136
+ }
137
+
138
+ /*
139
+ * PHP-CS-Fixer
140
+ * /
141
+ $output = array ();
142
+ $return = null;
143
+ exec(" php-cs-fixer --dry-run --level=psr2 " . escapeshellarg($fileName ), $output , $return );
144
+ if ($return ! = 0 || ! empty($output )) {
145
+ echo " PHP file fails contains CS issues: " . $fileName . " :" . PHP_EOL;
146
+ echo implode(PHP_EOL, $output ) . PHP_EOL;
147
+ $exit = 1;
148
+ continue ;
149
+ }
150
+ }
151
+
152
+ exit($exit );
126
153
` ` `
127
154
128
155
# # Keeping Up-to-Date
@@ -140,6 +167,10 @@ the following:
140
167
% git push origin
141
168
` ` `
142
169
170
+ If you' re tracking other branches -- for example, the "develop" branch, where
171
+ new feature development occurs -- you' ll want to do the same operations for that
172
+ branch; simply substibute " develop" for " master" .
173
+
143
174
# # Working on Zend Framework
144
175
145
176
When working on Zend Framework, we recommend you do each new feature or
@@ -199,6 +230,16 @@ email indicating you have changes to pull:
199
230
- The nature of the changes (e.g., ` implements
200
231
Zend_Service_Twitter` , ` fixes ZF-9295` , etc.)
201
232
233
+ # ## What branch to issue the pull request against?
234
+
235
+ Which branch should you issue a pull request against?
236
+
237
+ - For fixes against the stable release, issue the pull request against the
238
+ " master" branch.
239
+ - For new features, or fixes that introduce new elements to the public API (such
240
+ as new public methods or properties), issue the pull request against the
241
+ " develop" branch.
242
+
202
243
# # Branch Cleanup
203
244
204
245
As you might imagine, if you are a frequent contributor, you' ll start to
@@ -228,24 +269,10 @@ RSS feeds may be found at:
228
269
229
270
where <branch> is a branch in the repository.
230
271
231
- To subscribe to git email notifications, send an email to:
232
-
233
-
234
-
235
- You will need to reply to the verification email sent to you by this
236
- list.
237
-
238
- Should you wish to filter emails from the list, they will use the
239
- " subject" line of commit messages, preceded by ` [branch] ` , and come
240
-
272
+ To subscribe to git email notifications, simply watch or fork the zf2 repository
273
+ on GitHub.
241
274
242
275
## CONTRIBUTORS AND COMMITTERS
243
276
244
- For the immediate future, and until we create a community process team,
245
- only the Zend team will be committers. If you have a patch or
246
- feature-set you wish to have incorporated into the repository, please
247
- issue a pull request to a committer. A pull request may be done by using
248
- git' s "git-send-email" functionality, or by sending a request to a
249
- committer indicating the URL of your repository, the branch that should
250
- be pulled, and/or the specific revision(s) to pull.
251
-
277
+ Both Zend' s internal Zend Framework team and the members of the Community Review
278
+ team have push privileges to the ZF2 repository.
0 commit comments