Closing tickets in commit messages

If you want to close a ticket through a commit message, the git->trac integration works now. You just need to reference the ticket in your commit message like this: ticket:393. I'm not completely sure of the full syntax available for commit messages, but my commits I just did a little bit ago closed my test ticket with this syntax. We'll just have to be careful with this since we've frequently been changing tickets to merge requests so that the person committing the fix is often not the person that actually closes the ticket.

I also fixed another problem with viewing changesets through the tracker while I was working on this.


Nevermind, I found a place that documents the behavior. (down at the bottom of the page:

Closing/Commenting-on Tickets

You can automatically comment on or close one or more tickets by including special "commands" in the commit message. These can be anywhere, as the whole commit message is searched. The message is searched for strings of the form:

  • command #1
  • command #1, #2
  • command #1 & #2
  • command #1 and #2
where 'command' is one of "close", "closes", "closed", "fix", "fixes", "fixed", "addresses", "re", "refs", "references", or "see", and N in #N is the ticket number. All of these cause the commit message to be added as a note to the tickets; additionally the close* and fix* commands cause the corresponding tickets to be closed.

Note that you can both fix and reference as many tickets as desired in the commit message.

I'll add this to the git documentation page later.