mercredi 8 février 2012

My first Open Source commitment - Git short revision

Today, my patches for 2 maven projects have been accepted by the maven-buildNumber-plugin's project lead Olivier Lamy.

One of the web Java project, I currently working on, is fully automated with Maven. One interesting and useful thing is to have the date & the revision number at the bottom of the web page. Like this:
It was done with excellent maven plugin buildNumber - http://mojo.codehaus.org/buildnumber-maven-plugin

The problem was that the project SCM migrated from the SVN to Git. And the revision ID in Git is too long. In fact it's SHA-1 sequence that should be unique across the world and all possible revisions... So the build id at the bottom of the page was so ugly for business users that I receive the task to make it shorter.

After asking the question about the git short revision id in StackOverflow.com and in the user's mailing lists of the maven, I understood that the buildNumber plugin does not support this feature. And the project Lead, Olivier Lamy, gracefully proposed to me to make a patch and pointed out the first java class I have to look at.
The code he sent me was very clear and I quickly figured out how to add the new feature that I called shortRevisionLength.
After one day of working I have sent the patch to Olivier and created 2 issues on the codehouse JIRA server:
  1. http://jira.codehaus.org/browse/MBUILDNUM-86
  2. http://jira.codehaus.org/browse/SCM-664
I added some test cases and the documentation patch as well.

The next day the patch has been approved and integrated in the SVN. So, the next version of buildNumber plugin 1.1 contains some peace of code from Ukraine :) Nice.

1 commentaire:

Justin Smith a dit…

From the US...

Thanks for the contribution, saved me a huge headache!