Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Jetty/Contributor/Contributing Patches"

m
Line 5: Line 5:
 
== Git Diff ==
 
== Git Diff ==
  
The simplest way to contribute a patch is to make a modification to a cloned copy of jetty and then generate a diff between the two versions.
+
The simplest way to contribute a patch is to modify a cloned copy of jetty and then generate a diff between the original and the version that contains your patch.
  
 
From the top level of the cloned project:
 
From the top level of the cloned project:
Line 11: Line 11:
 
<tt>git diff > ######.patch</tt>
 
<tt>git diff > ######.patch</tt>
  
The hash marks should be the bugzilla issue that you will be attaching the issue to.  All patches coming into jetty @ eclipse much come in through bugzilla for IP tracking purposes.  Depending on the size of the patch the patch itself may be flagged as +iplog where it is subject to lawyer review and inclusion with our iplog from here to eternity.  We are sorry we are unable to apply patches that we receive via email. So if you have the bugzilla issue created already just attach the issue and feel free to bug us on IRC to take a look.  If there is no bugzilla issue yet, create one, make sure the patch is named appropriately and attach it.
+
The hash marks must be the bugzilla issue that you are addressing.  All patches coming into jetty @ eclipse must come through bugzilla for IP tracking purposes.  Depending on the size of the patch, the patch itself might be flagged as +iplog, which means it is subject to legal review and inclusion with our iplog from here to eternity.  We are sorry, but we are unable to apply patches that we receive via email. If you have the bugzilla issue created already, just attach the patch to it, and feel free to bug us on IRC to take a look.  If there is no bugzilla issue, create one, make sure the patch is named appropriately, and attach it.
  
When the developer reviews the patch and goes to apply it they will use:
+
When the developer reviews the patch and applies it, they do so as follows:
  
 
<tt>git apply < ######.patch</tt>
 
<tt>git apply < ######.patch</tt>
  
If you want to be a nice person, test your patch on a clean clone to ensure that it applies cleanly.  Nothing frustrated a developer quite like a patch that doesn't apply.
+
If you want to be a nice person, test your patch on a clean clone to ensure that it applies cleanly.  Nothing frustrates a developer quite like a patch that doesn't apply.
  
 
== Git Format Patch ==
 
== Git Format Patch ==
  
Another approach if you want your name in shiny lights in our commit logs is to use the format patch option.  With this approach you commit into your cloned copy of jetty and use the git format patch option to generate what looks like an email message containing all of the commit information.  This applies as a commit directly when we apply it so it should be obvious that as with the normal diff we much accept these sorts of patching only via bugzilla.
+
Another approach (if you want your name in shiny lights in our commit logs) is to use the ''format patch'' option.  With this approach you commit into your cloned copy of jetty and use the ''git format patch'' option to generate what looks like an email message containing all of the commit information.  This applies as a commit directly when we apply it, so it should be obvious that, as with the normal diff, we can accept these sorts of patches only via bugzilla.
  
 
From the top level of the cloned project:
 
From the top level of the cloned project:
Line 39: Line 39:
 
<tt>git format-patch -M -B 70e29326fe904675f772b88a67128c0b3529565e</tt>
 
<tt>git format-patch -M -B 70e29326fe904675f772b88a67128c0b3529565e</tt>
  
This will create a single patch file for each commit since the specified commit. The names will start with 0001-[commitmessage].patch. See http://www.kernel.org/pub/software/scm/git/docs/git-format-patch.html for details.
+
This creates a single patch file for each commit since the specified commit. The names start with 0001-[commitmessage].patch. See http://www.kernel.org/pub/software/scm/git/docs/git-format-patch.html for details.
  
When a developer goes to apply this sort of patch then we must assume responsibility for applying it to our codebase from the IP perspective.  So we much be comfortable with the providence of the patch and that it is clear of potential issues.  This is not like a diff where you get to edit it and clean up issues before it get applied.  The commit is recorded locally and the developer will then have a chance to make additional commits to address any lingering issues.  It is critically important that developers applying these sorts of patches are fully aware of what is being committed and what they are signing off on.
+
When a developer applies this sort of patch, they must assume responsibility for applying it to our codebase from the IP perspective.  So we must be comfortable with the providence of the patch, and make sure that it is clear of potential issues.  This is not like a diff where you get to edit it and clean up issues before it is applied.  The commit is recorded locally, and the developer then has a chance to make ''additional'' commits to address any lingering issues.  It is critically important that developers applying these sorts of patches be fully aware of what is being committed and what they are signing off on.
  
To apply the patch the developer will use a command like:
+
To apply the patch the developer uses a command like:
  
 
<tt>git am -s 0001-353563-HttpDestinationQueueTest-too-slow.patch</tt>
 
<tt>git am -s 0001-353563-HttpDestinationQueueTest-too-slow.patch</tt>
  
Providing it applies cleanly there will now be a commit in their local copy and they can either make additional commits or push it out.  The '-s' option attaches a 'Signed By: ' line to the commit with the developers commit information.  This is required, without it the commit should be rejected by the eclipse git server as not valid.  There is an update hook in place that validates that either the commit or signed by fields are in fact eclipse committers authorized to commit to the repository.
+
Providing it applies cleanly, there is now a commit in their local copy and they can either make additional commits or push it.  The '-s' option attaches a 'Signed By: ' line to the commit with the developer's commit information.  This is required; without it the eclipse git server rejects the commit  as invalid.  There is an update hook in place that validates that either the commit or signed by fields are in fact eclipse committers authorized to commit to the repository.
  
 
== Git Amend ==
 
== Git Amend ==
  
Alternatively, for troublesome patches that do not seem to apply cleanly with <tt>git am</tt>, you can use <tt>git commit --amend</tt> to modify the author and signoff the commit.
+
Alternatively, for troublesome patches that do not seem to apply cleanly with <tt>git am</tt>, you can use <tt>git commit --amend</tt> to modify the author and sign off the commit.
 
For example:
 
For example:
  
Line 59: Line 59:
 
$ git commit -a -m "<Original commit message from John Doe>"
 
$ git commit -a -m "<Original commit message from John Doe>"
  
At this point the patch is committed with the committer's name on a local branch
+
At this point the patch is committed with the committer's name on a local branch:
  
 
$ git commit --amend --author "John Doe <john.doe@who.com>" --signoff
 
$ git commit --amend --author "John Doe <john.doe@who.com>" --signoff
  
Now the patch has the right author and it has been signed off
+
Now the patch has the correct author and it has been signed off:
  
 
$ git checkout master
 
$ git checkout master
 
$ git merge patch
 
$ git merge patch
  
Now the local branch has been merged into master with the right author
+
Now the local branch has been merged into master with the correct author:
  
 
$ git branch -d patch
 
$ git branch -d patch

Revision as of 18:12, 23 February 2012



How to contribute a patch to Jetty @ Eclipse.

Git Diff

The simplest way to contribute a patch is to modify a cloned copy of jetty and then generate a diff between the original and the version that contains your patch.

From the top level of the cloned project:

git diff > ######.patch

The hash marks must be the bugzilla issue that you are addressing. All patches coming into jetty @ eclipse must come through bugzilla for IP tracking purposes. Depending on the size of the patch, the patch itself might be flagged as +iplog, which means it is subject to legal review and inclusion with our iplog from here to eternity. We are sorry, but we are unable to apply patches that we receive via email. If you have the bugzilla issue created already, just attach the patch to it, and feel free to bug us on IRC to take a look. If there is no bugzilla issue, create one, make sure the patch is named appropriately, and attach it.

When the developer reviews the patch and applies it, they do so as follows:

git apply < ######.patch

If you want to be a nice person, test your patch on a clean clone to ensure that it applies cleanly. Nothing frustrates a developer quite like a patch that doesn't apply.

Git Format Patch

Another approach (if you want your name in shiny lights in our commit logs) is to use the format patch option. With this approach you commit into your cloned copy of jetty and use the git format patch option to generate what looks like an email message containing all of the commit information. This applies as a commit directly when we apply it, so it should be obvious that, as with the normal diff, we can accept these sorts of patches only via bugzilla.

From the top level of the cloned project:

Make your changes and commit them locally using git commit. Then use git log to identify the commit(s) you want to include in your patch:

commit 70e29326fe904675f772b88a67128c0b3529565e
Author: Thomas Becker <tbecker AT intalio . com>
Date:   Tue Aug 2 14:36:50 2011 +0200

   353563: HttpDestinationQueueTest too slow

Use git format-patch to create the patch:

git format-patch -M -B 70e29326fe904675f772b88a67128c0b3529565e

This creates a single patch file for each commit since the specified commit. The names start with 0001-[commitmessage].patch. See http://www.kernel.org/pub/software/scm/git/docs/git-format-patch.html for details.

When a developer applies this sort of patch, they must assume responsibility for applying it to our codebase from the IP perspective. So we must be comfortable with the providence of the patch, and make sure that it is clear of potential issues. This is not like a diff where you get to edit it and clean up issues before it is applied. The commit is recorded locally, and the developer then has a chance to make additional commits to address any lingering issues. It is critically important that developers applying these sorts of patches be fully aware of what is being committed and what they are signing off on.

To apply the patch the developer uses a command like:

git am -s 0001-353563-HttpDestinationQueueTest-too-slow.patch

Providing it applies cleanly, there is now a commit in their local copy and they can either make additional commits or push it. The '-s' option attaches a 'Signed By: ' line to the commit with the developer's commit information. This is required; without it the eclipse git server rejects the commit as invalid. There is an update hook in place that validates that either the commit or signed by fields are in fact eclipse committers authorized to commit to the repository.

Git Amend

Alternatively, for troublesome patches that do not seem to apply cleanly with git am, you can use git commit --amend to modify the author and sign off the commit. For example:

$ git checkout -b patch
$ git apply john-doe.patch
$ git commit -a -m "<Original commit message from John Doe>"

At this point the patch is committed with the committer's name on a local branch:

$ git commit --amend --author "John Doe <john.doe@who.com>" --signoff

Now the patch has the correct author and it has been signed off:

$ git checkout master
$ git merge patch

Now the local branch has been merged into master with the correct author:

$ git branch -d patch
$ git push

Using Gerrit @ Eclipse

Someday we'll have access to Gerrit @ Eclipse. https://bugs.eclipse.org/bugs/show_bug.cgi?id=283749

Copyright © Eclipse Foundation, Inc. All Rights Reserved.