SubmittingPatches 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. How to Contribute Patches to FreeSWITCH
  2. =======================================
  3. Download the Source Code
  4. ------------------------
  5. git clone https://freeswitch.org/stash/scm/fs/freeswitch.git
  6. cd freeswitch
  7. Ensure Git is Setup
  8. -------------------
  9. # tell git your full name and email address; make sure to use your
  10. # real name and not a username
  11. ./scripts/setup-git.sh
  12. Create Your Commits
  13. -------------------
  14. # create a topic/feature branch in your local repository
  15. git checkout -b myfeature
  16. # make your change
  17. emacs .
  18. # commit the results locally; see below for how to write a good
  19. # commit message
  20. git commit -va
  21. # create more commits as needed such that each commit represents a
  22. # logically separate change
  23. #while true; do emacs .; git commit -va; done
  24. # review changes; ensure your author name is correct
  25. git log -p
  26. Create a Pull Request
  27. ---------------------
  28. # navigate to the FreeSWITCH JIRA
  29. chromium https://freeswitch.org/jira
  30. # create an account in JIRA and create a new issue
  31. # navigate to FreeSWITCH Stash
  32. chromium https://freeswitch.org/stash
  33. # Using the same credentials as Jira, login to Stash; create a forked FS repository; read
  34. # the details here:
  35. chromium https://freeswitch.org/confluence/display/FREESWITCH/Pull+Requests
  36. # add your repository as a remote (change to your username)
  37. git remote add stash ssh://git@freeswitch.org:7999/~johndoe/freeswitch.git
  38. # push your changes to a branch
  39. git push stash +HEAD:myfeature
  40. # create a pull request as described here:
  41. chromium https://freeswitch.org/confluence/display/FREESWITCH/Pull+Requests
  42. Guidelines for a Good Commit
  43. ----------------------------
  44. To the extent possible and appropriate, address only one issue per
  45. commit. When we review your commit, anything that doesn't need to be
  46. there will only create confusion.
  47. This means that, for example, unrelated refactoring or whitespace
  48. cleanups should generally happen in separate commits. Whitespace
  49. cleanup commits should not change anything other than whitespace, and
  50. refactoring commits should strive to preserve identical behavior.
  51. However, don't go overboard. A commit should do some identifiable
  52. thing completely. If you're adding a new module, the build changes
  53. for that module should go in the commit that adds the module itself.
  54. If you're adding a feature, the feature should work after applying
  55. that commit.
  56. We don't need to see your missteps and corrections. Use `git rebase
  57. -i` to squash those out of your history before submitting the commit
  58. series to us. It should look like you got everything right the first
  59. time.
  60. Use `git log -p` to verify that each diff is correct and minimal, and
  61. that your git author name is correct and complete.
  62. Writing a Good Commit Message
  63. -----------------------------
  64. Your commit message consists of two parts: the subject and the body.
  65. The subject is like the subject in an email message. It should be
  66. short -- typically less than 50 characters -- and it should concisely
  67. describe the purpose or effect of your change.
  68. If you're having a difficult time writing a short subject for your
  69. commit, perhaps your commit should be broken into smaller separate
  70. commits.
  71. The commit body can be longer and can consist of multiple paragraphs.
  72. The text of the body should be hard wrapped to 68-72 characters. (In
  73. Emacs you can hard wrap text with `M-q`.)
  74. When writing the commit body, describe in detail the problem that your
  75. commit aims to solve, how your commit solves the problem, and any
  76. changes in behavior that result from your change, such as new
  77. variables, command flags, or breaks in backward compatibility.
  78. Your commit message should be written in the present tense in
  79. imperative style. Your message should talk about what the patch
  80. *does*, not what you *did* to write it.
  81. The commit subject is the first line of your commit message, then
  82. there is an empty line, then your commit body starts. A good commit
  83. message might look like this:
  84. commit b5c64234ea5d4417abe02b282d6f41c019f2252f
  85. Author: John Doe <johndoe@example.com>
  86. Date: Tue Jan 19 03:14:07 2014 +0000
  87. Add frobinator support to mod_sofia
  88. Without proper frobinator support users had to make multiple calls
  89. to shell scripts to do the sort of frobbing needed in high call
  90. volume environments.
  91. With this change, we now link to libfrob and support the IETF
  92. draft-cross-voip-frobbing API.
  93. After appropriate amounts of frobbing have been done, a new variable
  94. `frobbing_done` is set in the caller's channel.
  95. FS-XXXX #resolve
  96. Patches Related to JIRA Issues
  97. ------------------------------
  98. When your patch is related to an issue logged in JIRA, add the
  99. identifier for the issue (e.g. FS-XXXX) to the body of your commit
  100. message at the beginning of a line, typically the last line or just
  101. before "Signed-off-by:" and "Thanks-to:" lines. This helps our JIRA
  102. bot do useful things by relating the commit to the issue.
  103. If you believe your patch resolves the issue in question, follow the
  104. issue number with a space and the "#resolve" directive as in the
  105. example above.
  106. Avoid Merges
  107. ------------
  108. When you've created a local git branch to make and test your changes,
  109. it can be tempting to merge that branch periodically against our git
  110. HEAD, particularly if the branch lingers for some time. Don't do
  111. this. Instead, please rebase your branch onto our tree before
  112. submitting the commits to us. Random "update branch to master" merges
  113. make our history hard to understand and make it more difficult to
  114. isolate regressions with `git-bisect`.
  115. New Module Checklist
  116. --------------------
  117. When proposing a new module:
  118. * Add a `Makefile.am` for the module
  119. * Add the module to the FS `configure.ac`
  120. * Add the module to `build/modules.conf.in` (commented out)
  121. * Describe the module in as much detail as possible in the comments
  122. at the top of the module
  123. * Add our whitespace footer to the module files; ensure the \*.[ch]
  124. module files use tabs for indentation and are free of trailing
  125. whitespace (e.g. in Emacs, run `M-x whitespace-mode`, then `M-x
  126. whitespace-cleanup`)
  127. * Remove any unused code left over from debugging
  128. * Ensure symbols not meant to be exported are declared `static`
  129. * Don't add any files to `conf/vanilla`
  130. * Write a commit message body describing the module, why it's useful,
  131. what it does, how it works, and any parts not yet implemented
  132. Do As We Say...
  133. ---------------
  134. When you look in our git history, you'll find not all commits follow
  135. the guidelines here. Don't be fooled by this. These guidelines are
  136. what we want, and your commits should follow them.
  137. It's always difficult to counsel, "do as we say and not as we do," but
  138. the truth is that the format of your commits will be held to a
  139. different standard than the commits of people who have written the
  140. majority of the code in FS. For one thing, your commits will be
  141. reviewed, so following a careful format helps us to review and merge
  142. your patches quickly and efficiently.
  143. We want a clean and sensible git history, and over time more
  144. contributors will be following the guidelines here.
  145. Where to Go for Help
  146. --------------------
  147. If you have any questions or run into any roadblocks please reach out
  148. to us. You can send an email to our development mailing list:
  149. > http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
  150. Note that while you're free to send a patch to that list for questions
  151. or for review, patches sent to the mailing list will not be considered
  152. for inclusion. Patches that you want included in FreeSWITCH must be
  153. submitted to JIRA.
  154. You can also reach us on freenode.net at:
  155. > \#freeswitch-dev
  156. Finally, feel free to join us in our weekly conference call. Many of
  157. the core developers are often on the call and you'll have an
  158. opportunity at the beginning or end of the call to ask your questions:
  159. > https://freeswitch.org/confluence/display/FREESWITCH/ClueCon+Weekly+Conference+call