Honor renames in patch views
[TortoiseGit.git] / doc / HowToContribute.txt
blob21d7f49aebfcd5da3a2aba38b7213f135917f14b
1 Checklist (and a short version for the impatient):\r
2 \r
3 Please also see https://tortoisegit.org/contribute/!\r
4 \r
5         Submission:\r
6 \r
7         - open an issue on https://tortoisegit.org/issues or go to an\r
8           issue you want to fix. Then you have the following options:\r
9           . attach a patch there\r
10           . provide a link to a branch you want the maintainers to pull from\r
11           . open a GitLab merge request and put the link into the issue\r
12           . open a GitHub pull request and put the link into the issue\r
14         For existing issues it is recommended to start commenting on the issue\r
15         in order to discuss possible solutions before starting coding.\r
17         Commits:\r
19         - make commits of (small) logical units\r
20         - do not check in commented out code, unrelated changes or unneeded files\r
21         - the subject (first line of the commit message) should be a short\r
22           description and should skip the full stop. If it is about a bug \r
23           report/issue, use "Fixed issue #NUMBER: ISSUE'S TITLE"\r
24         - the second line of commit message should be an empty line\r
25         - the body which starts from the third line should provide a meaningful\r
26           commit message\r
27         - add a "Signed-off-by: Your Name <you@example.com>" line to the commit\r
28           message to confirm that you agree to the Developer's Certificate of\r
29           Origin.\r
30           please use your real name.\r
32         Coding style:\r
34         - based on Visual Studio default coding style (try to copy & paste)\r
35         - the old code migrates to new coding style only when modifying it.\r
36         - variable definitions (as it is a type definition; e.g., CGitHash* name \r
37           and CGitHash& name)\r
38         - for `if`, `for`, `while` a spaces between the keyword and the \r
39           parenthesis (e.g., if ()).\r
40         - braces go on the next line for `if`, `for`, `else`, ...\r
41         - If an `if` contains only one action, no braces needed.\r
42         - function calls, there is no space before the parenthesis (e.g, method()).\r
43         - no spaces before and after parentheses (e.g., (something)).\r
44         - spaces between &&, + and other operands also after comma(,).\r
45         - no variable shadowing.\r
46         - for variable names: we don't have a strict rule here, should be speak \r
47           for it self.\r
48         - try not to nest too deeply and return as early as possible.\r
49         - Only use `this` if needed.\r
51 Longer version:\r
53 (0) Make separate commits for logically separate changes.\r
55 Unless your patch is really trivial, you should not be sending\r
56 out a patch that was generated between your working tree and\r
57 your commit head. Instead, always make a commit with complete\r
58 commit message and generate a series of patches from your\r
59 repository.\r
61 Give an explanation for the change(s) that is detailed enough so\r
62 that people can judge if it is good thing to do, without reading\r
63 the actual patch text to determine how well the code does what\r
64 the explanation promises to do.\r
66 If your description starts to get too long, that's a sign that you\r
67 probably need to split up your commit to finer grained pieces.\r
68 That being said, patches which plainly describe the things that\r
69 help reviewers check the patch, and future maintainers understand\r
70 the code, are the most beautiful patches. Descriptions that summarise\r
71 the point in the subject well, and describe the motivation for the\r
72 change, the approach taken by the change, and if relevant how this\r
73 differs substantially from the prior version, are all good things\r
74 to have.\r
76 Oh, another thing. We are picky about whitespaces. To help ensure this\r
77 does not happen, run git diff --check on your changes before you commit.\r
80 (1a) Generate your patch using git tools out of your commits (Patch serial)\r
82 git based diff tools generate unidiff which is the preferred format.\r
84 Please make sure your patch does not include any extra files\r
85 which do not belong in a patch submission. Make sure to review\r
86 your patch after generating it, to ensure accuracy. Before\r
87 sending out, please make sure it cleanly applies to the "master"\r
88 branch head.\r
91 (1b) Create a merge/pull request\r
93 Push your changes to a public repository. Use a brief branch name\r
94 describing your changes.\r
96 Please make sure your pull request does not include any extra files\r
97 which do not belong in a submission. Make sure to review your patch\r
98 after generating it, to ensure accuracy.\r
100 There is no need to generate a "formal" pull request. The URL and\r
101 branchname is necessary - or create a GitLab merge request\r
102 (https://gitlab.com/tortoisegit/tortoisegit/) or a GitHub pull request\r
103 (https://github.com/TortoiseGit).\r
106 (2) Sign your work\r
108 To improve tracking of who did what, we've borrowed the\r
109 "sign-off" procedure from the Linux kernel project on patches\r
110 that are being emailed around. Although TortoiseGit is a lot\r
111 smaller project it is a good discipline to follow it.\r
113 The sign-off is a simple line at the end of the explanation for\r
114 the patch, which certifies that you wrote it or otherwise have\r
115 the right to pass it on as a open-source patch. The rules are\r
116 pretty simple: if you can certify the below:\r
118         Developer's Certificate of Origin 1.1\r
120         By making a contribution to this project, I certify that:\r
122         (a) The contribution was created in whole or in part by me and I\r
123             have the right to submit it under the open source license\r
124             indicated in the file; or\r
126         (b) The contribution is based upon previous work that, to the best\r
127             of my knowledge, is covered under an appropriate open source\r
128             license and I have the right under that license to submit that\r
129             work with modifications, whether created in whole or in part\r
130             by me, under the same open source license (unless I am\r
131             permitted to submit under a different license), as indicated\r
132             in the file; or\r
134         (c) The contribution was provided directly to me by some other\r
135             person who certified (a), (b) or (c) and I have not modified\r
136             it.\r
138         (d) I understand and agree that this project and the contribution\r
139             are public and that a record of the contribution (including all\r
140             personal information I submit with it, including my sign-off) is\r
141             maintained indefinitely and may be redistributed consistent with\r
142             this project or the open source license(s) involved.\r
144 then you just add a line saying\r
146         Signed-off-by: Random J Developer <random@developer.example.org>\r
148 This line can be automatically added by Git and TortoiseGit.\r
150 Also notice that a real name is used in the Signed-off-by: line. Please\r
151 don't hide your real name.\r
153 If you like, you can put extra tags at the end:\r
155 1. "Reported-by:" is used to credit someone who found the bug that\r
156    the patch attempts to fix.\r
157 2. "Acked-by:" says that the person who is more familiar with the area\r
158    the patch attempts to modify liked the patch.\r
159 3. "Reviewed-by:", unlike the other tags, can only be offered by the\r
160    reviewer and means that she is completely satisfied that the patch\r
161    is ready for application. It is usually offered only after a\r
162    detailed review.\r
163 4. "Tested-by:" is used to indicate that the person applied the patch\r
164    and found it to have the desired effect.\r
166 You can also create your own tag or use one that's in common usage\r
167 such as "Thanks-to:", "Based-on-patch-by:", or "Mentored-by:".\r
169 ------------------------------------------------\r
170 An ideal patch flow\r
172 Here is an ideal patch flow for this project the current maintainer\r
173 suggests to the contributors:\r
175  (0) You come up with an itch. You code it up.\r
176      For exisiting issues it is recommended to start commenting on the issue\r
177      in order to discuss possible solutions before starting coding.\r
179  (1) Open an issue on https://tortoisegit.org/issues or attach\r
180      your changes to another already reported issue. Attach the patches\r
181      or provide a merge/pull request (URL branch) there.\r
183  (2) You get comments and suggestions for improvements. You may\r
184      even get them in a "on top of your change" patch form.\r
186  (3) Polish, refine, and re-send. Go back to step (2).\r
188  (4) The patch will be applied to master.\r