X.Org uses self-hosted GitLab for code development. This page describes the workflow of making and submitting changes. We assume you have a git cloned repository and are familiar with making code changes and commits.
Workflow overview
The contributor does the following:
- Commit code changes to the local repository using the git-commit command
- Create a Merge Request in the freedesktop.org GitLab instance
The reviewers do one of the following:
- Signify their formal approval or disapproval (Acked-by or Nacked-by) or informal via the "Approve" button or a simple "LGTM" comment in GitLab.
- State an opinion about the appropriateness of the patch (Reviewed-by)
- Test the patch (Tested-by)
The module maintainer does the following:
- Merges the merge request in GitLab, or closes the MR with an explanation.
Making code changes
This is where it all starts. Think about the reviewers when you are organizing code changes. Focus on one issue and change one or more files to resolve the issue. In our example patch, the code change only deals with fixing the wrong behavior of the mouse buttons reported by the user.
Changes should follow the coding style guidelines.
Before creating a commit, ensure your git user name and e-mail is configured correctly using the git-config command. Use your real name as opposed to a nickname as you will be signing off your patches, indicating that you are able to release the patch under the licensing terms of the module.
$> git config --global --get user.name $> git config --global --get user.email
Creating a commit
Once the code changes are implemented and tested on your local repository, they must be committed. A commit object is created which wraps your code changes with various git information. It is included in the patch you will create later. Nothing is sent to the remote git repository on the freedesktop.org server.
You tell git to add the files you changed using the git-add command. You then commit the changes using the git-commit command.
$> git add mipointer.c # file changed to fix the bug $> git commit -s # -s adds the sign-off tag in the commit text
The git commit command raises the nano editor for you to enter the commit message that is describe in the next section. When you exit the editor, the commit object is created. Monitor the changes to the local repository using the git-status command and the git-show command.
Commit message format
Begin the commit message with a single short (less than 78 character) line summarizing the changes, followed by a blank line and then a more thorough description. Tools that turn commits into email, for example, use the first line on the Subject: line and the rest of the commit in the body.
When referencing a reported bug, use the bug number from the GitLab issue. If there is no corresponding issue, you should upstream the bug from your distribution to freedesktop.org.
An example of how to reference a reported bug in the commit message:
Closes: #12345 Closes: https://gitlab.freedesktop.org/xorg/xserver#12345
Different projects may have different preference on how these tags are formed, check the git history and the CONTRIBUTING.md if it exists.
In the case of a patch fixing an earlier commit, it is recommended to reference that commit via its sha and commit message subject:
Fixes: abcdef1234567 ("dix: Change bar to foo")
This format is produced by the command:
$ git show -s --pretty='format:Fixes: %h (\"%s\")'" <git-commit-ref>
Subject line
The subject line summarizes the code changes contained in the patch. For large components such as the X Server, prefix with the subsystem (e.g. dix, Xi, xfree86, kdrive, etc.). Look at the xserver's git log to give you guidance.
The subject line from the example, as it appears in the commit object:
mi: don't call UpdateSpriteForScreen if we have Xinerama enabled. #18668
Message body
Explain in sufficient detail what the patch does and why this is necessary. This does not mean you need to describe the actual source changes (e.g. "changed x to be 10, then added x to y"). Use common sense and look at git logs for guidance. See also "on commit messages"
The message body may also contain your sign-off tag (if required by the project, most X.Org projects no longer require them), so in our example:
Signed-off-by: Firstname Lastname <your@email.net>
Other tags may be added after the patch review as hinted in the workflow overview.
Creating a merge request
X.Org uses GitLab, and virtually all subprojects use merge requests for development. First, you will need to "fork" the repo into your personal namespace and add that fork to your git remotes. Then you can push your working branch to that remote.
If this is your first time contributing to a project hosted on freedesktop.org, you will have to request permission to fork. See the [freedesktop.org wiki|https://gitlab.freedesktop.org/freedesktop/freedesktop/-/wikis/home]) for details.
As a general rule, you add your fork as a git remote:
$> git remote add myfork git@ssh.gitlab.freedesktop.org:$USER/repositoryname.git $> git push myfork <branchname>
This will display a link that can be used to file a merge request.
Please refer to docs.gitlab.com for detailed documentation and tutorials.
Signing off and reviewing
X.Org developers may use a number of formal tags to acknowledge patches, both in a commit message and when reviewing patches. Here's a short summary for each tag, please refer to the Linux kernel's Documentation/SubmittingPatches file for details. The summaries below are copied from that file.
- Signed-off-by: certifies that you wrote it or otherwise have the right to pass it on as a open-source patch. Specifically, that you agree to the Developer's Certificate of Origin
- Acked-by: If a person was not directly involved in the preparation or handling of a patch but wishes to signify and record their approval of it then they can arrange to have an Acked-by: line. Acked-by: does not necessarily indicate acknowledgement of the entire patch.
- Tested-by: A Tested-by: tag indicates that the patch has been successfully tested (in some environment) by the person named. This tag informs maintainers that some testing has been performed, provides a means to locate testers for future patches, and ensures credit for the testers.
- Reviewed-by: A Reviewed-by tag is a statement of opinion that the patch is an appropriate modification without any remaining serious technical issues. Any interested reviewer (who has done the work) can offer a Reviewed-by tag for a patch.
Whenever you review a patch in a merge request, feel free to provide the appropriate tag as a reply email or comment.
A less formal way of approving a patch is to simply click the "Approve" button in GitLab or a "LGTM" (looks good to me) comment.
Getting no response
We don't have an abundance of developers and sometimes bugs or patches get dropped. If this happens to your patch, ping the maintainers in a merge request after a sufficient period (a few days at the very least, weeks for less active projects without maintainers).
Changing a Merge Request
Likely, a developer will tell you to make some changes to the code or the commit message. Although you have committed your changes locally, you can still edit them. X.Org does not use GitLab's "squash on merge" feature; each merge request must be a set of individual logical changes.
git commit --amend lets you edit the last commit. By default, this only edits the commit message (e.g. git commit --amend -s adds the signed-off-by if you've forgotten it). Any code changes you want to incorporate into the commit, use git add filename before amending the commit. You can force-push to your gitlab branch which will update the merge request and re-trigger the CI, where applicable.
If your patch is not the last commit in your local tree, consider using the git-rebase command in interactive mode.
Further reading
- List of Xorg maintainers
- Kernel patch submission process: details about patch format and contents equally apply to X.Org patches.
- Git User's Manual
- Gitlab User's Manual