Skip to content

Formatting and sending patches

Konstantin Osipov edited this page Apr 19, 2023 · 13 revisions

You commit locally to your git tree and then prepare patches that you send to the mailing list.

Configuring git

First, make your name and email address are configured for git:

$ git config user.name "Your Name"
$ git config user.email "your@mail.com"

Also configure git to detect renames and copies to make git format-patch output easier to review:

git config --global diff.renames copies

Additionally configure git to order the files in the patch according to our conventions (headers first): Run (in your repo):

git config diff.orderFile .gitorderfile

An example .gitorderfile is like follows:

*.py
*.txt
*.g
*.rl
*.h
*.hh
*.c
*.cc
*

Commiting your changes

Then, make your modifications in your own private branch:

$ git checkout -b features/foo # branches from master

To commit changes, do:

$ git commit -a --signoff # commit everything

Please prepare a commit message for every commit:

http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html

https://chris.beams.io/posts/git-commit/

Sending the patches

Once you have commits you want to send out, you can use git send-email to generate and send them. [1]

For multiple patches, use:

$ git send-email -n -v1 --cover-letter --annotate master..

for a single patch:

$ git send-email -1 -v1

(you can use --annotate to add details, and adjust -v1 for follow-up versions).

You can also use git format-patch and git send-mail separately if you prefer.

Git Gmail support

git config sendemail.smtpencryption tls
git config sendemail.smtpserver smtp.googlemail.com
git config sendemail.smtpuser myemailaddr@gmail.com
git config sendemail.smtpserverport 587

You can find more details on how to configure git to use Gmail here:

http://morefedora.blogspot.se/2009/02/configuring-git-send-email-to-use-gmail.html

Without 2FA on your Google account it is possible to work with LSA (less secure apps) enabled (Account settings -> Security -> Less Secure Apps).

If you use 2FA on your account you need an application-specific password. You can generate an application-specific password and use that for git-send-email at:

https://myaccount.google.com/apppasswords [how]

After you sign in, select App ("Mail") and Device ("Other", followed by anything), then select "Generate".

You can save SMTP password in your git configuration as follows:

$ git config --global sendemail.smtppass "<password>"

Arch Linux issues

Arch has 2 issues related to the git send-email:

To fix them and make git send-email work execute:

sudo pacman -S perl-io-socket-ssl perl-mime-tools perl-authen-sasl
Clone this wiki locally