a guide to writing git commit messages

The GOPW application period is coming to a close soon, and so potential interns are currently getting their initial contribution in to qualify.

Obviously the nicest way to submit your patch is as a commit, or series of commits using git, either via git bz or git format-patch (a branch is nice too, but submitting the patch in Bugzilla allows for inline review).

Of course, after your patch is correct, the maintainer is going to want to merge it into the tree, in which case you need to have a useful commit message. GNOME has some guidelines on commit messages, but here are the important dot points:

  • the first line should be a short description, no more than 72 characters and does not end with a full stop;
  • the next line should be empty space;
  • following this is an optional longer description, this should be written in regular paragraphs with full sentence structure;
  • finally if this patch fixes an open bug, there should be a link to the bug report, in a paragraph by itself.

Here are some good examples taken from Empathy:

Don't destroy MainWindow on delete-event, just hide it

This stops MainWindow being unreferenced, and prevents crashes caused by things which then try to use it.

Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=659118

This one has a tag:

e-account-widget-jabber: Use GtkGrid instead of GtkTable

This works around bug #657621.


Here’s another way of doing a tag (preferred by some projects):

[contact-chooser] emit 'activate' on 'row-activated' as well

This means the selection can be activated when the treeview is focused.

Or a one-liner commit:

[contact-chooser] Move the selection up/down without defocusing the entry

Remember that your commit message is important. They tell other developers what’s changed. What a commit fixes, or does, or is meant to do, and occasionally, what it doesn’t do. Commit messages are often used by the maintainer to write the release notes. When things break, people come back looking through the code for what broke it (e.g. via a git bisect) so clear and useful commit messages are essential.

gnome-terminal menubar issue in Ubuntu 11.10

I upgraded to Ubuntu 11.10 today, which seems to have done a nice enough job of integrating GNOME 3.2, but I was instantly driven mad by all of my GNOME Terminals showing their menubars, in what appeared to be direct contravention of what the setting appeared to be (or even what GTK+ thought the visibility status of the widget was!). This was GNOME bug #658760.

After a stack of debugging and one lucky break, I discovered the culprit was infact Ubuntu’s appmenu module.

[The lucky break was that while setting up a bisect, I realised I could replicate the bug only in the GTK+ 3 build of the terminal, which was printing out warnings about appmenu, something I’d already uninstalled for GTK+ 2.]

Anyway, you can fix the problem by removing appmenu-gtk3 (personally I’d remove appmenu-*) or unsetting the environment variable UBUNTU_MENUPROXY which is set in /etc/Xsession.d/80appmenu or something. The Ubuntu bug is #879190.


Random side note: can someone update my hackergotchi please?

Finding redundant GObject classes in Empathy

As part of a bugfix I did today1, I made a commit to remove a redundant class from Empathy, which made me wonder if there were any other redundant classes in Empathy. A quick grep of G_DEFINE_ told me there are some 116 classes in Empathy, so I wasn’t going to check them all by hand.

Instead I put together this script, which I share with you in case it’s useful, which basically checks for all classes defined with G_DEFINE_TYPE and then looks to see if anything with that namespace is used in another file. It generates false positives for classes that aren’t used outside the file they’re defined in, or classes that have different namespaces to the classname, but it produces a much more manageable list.

I did consider looking for unused symbols, but couldn’t work out an easy way to do it properly. Empathy’s compile process is split into two archive libraries (libempathy.a and libempathy-gtk.a) and several binaries (empathy, empathy-call, empathy-accounts, etc.), so I couldn’t think of a way to ask the linker to find any unused symbols. I put together this second script, which will build a list of symbols in archives and look for those symbols copied into the binaries, which gets some of the way there, but will miss any unused symbols defined in the binaries’ sources (src/).

  1. Thanks, as always, to my employer, Collabora, for letting me work on Empathy []

Finding Ada — Chandni Verma and Tiffany Antopolski

October 7th is Ada Lovelace Day. A day that showcases women in science and technology by profiling a woman technologist or scientist on your blog.

This year I wanted to write about two women who I’ve met and worked with in the last year as a mentor of the GNOME Outreach Programme for Women and the Google Summer of Code.

Chandni Verma
I met Chandni when she applied to be an Empathy intern for the GNOME Outreach Programme for Women. Chandni had never worked in open source before, but she approached it with an amazingly keen enthusiasm. Before too long Chandni began to grasp the ropes, learning GTK+ and Telepathy. She then went on to fix bugs in Empathy as well as the Telepathy connection managers.

Chandni studied computer science at the Dr M.C. Saxena College Of Engineering & Technology and has a passion for algorithms and would regularly participate in algorithm competitions. She learned about open source from a friend and in her final year of college and ordered Ubuntu CDs to check it out. Chandni says “I liked the idea of open source particularly since it allowed one to learn and evolve without any restrictions even if you are a student.

Chandni applied for GOPW after completing her final year and has remained working on Empathy since the end of her internship. Chandni gave her first conference presentation, detailing her experience with the programme, at GNOME.Asia. She had hoped to give it again at the Desktop Summit, but unfortunately bureaucracy got in the way. She looks forward obtaining a position with a company working on GNOME.

Tiffany Antopolski
Tiffany was in the same intake of the GOPW as Chandni, working on the documentation for GNOME with Paul Cutler. I then met Tiffany when she applied for the Google Summer of Code to work on integrating Empathy and Evince.

Tiffany is studying software engineering at McMaster University and also taught first year programming to students of the same course, having helped to design the curriculum. Before studying software engineering, Tiffany was a veterinary technician, and used to work in an emergency vet clinic. She also works part time in a neuroscience research lab.

Tiffany got involved in GNOME through the GNOME Documentation Project after being an Ubuntu user for around two years prior. In 2011 Tiffany attended the GNOME docs hackfest, the Open Documentation Conference and the Desktop Summit, where she worked on improving the documentation for GNOME. She successfully applied for Google Summer of Code with a project to work on integrating Telepathy into Evince. Recently Tiffany began working on the Esperanto translation for GNOME.