I love git, but I also loved ChangeLog files and git is not so good at merging them. For a while I played around with gnulib‘s git-merge-changelog which made merges really easy. It worked fairly well, but now I’m bored of documenting my changes twice, both in the ChangeLog file and in the git commit log.
The coreutils project has been creating its ChangeLog file from the git commit logs for a little while now, and I decided to take a look at how that’s done. Now, at last, system-config-printer can do that too. Here is how it works.
Step 1 happened a while ago, and that was to modify the style of my git commit log entries. I now write a single line at the top giving a summary of the overall change (as before), so that I get nice output from tools that want to abbreviate the commit log to one line. Then I leave a blank line, and below that my ChangeLog-style entry with no indentation.
Firstly, the gitlog-to-changelog script from gnulib has been added to the repository. This is the build tool Jim Meyering wrote which does all the work.
Next, I renamed the ChangeLog file “ChangeLog-OLD”, because I’d like to keep that history around without any alterations.
I use automake in system-config-printer, but it gets upset if there is no ChangeLog file. To pacify it I modified the “bootstrap” script to create an empty ChangeLog file. I added “/ChangeLog” to the .gitignore file so that I don’t get continually told about this dummy file not being under revision control.
Finally, to generate the ChangeLog file from git commit logs whenever a new release is built I added a “dist-hook” rule to the automake file, getting it to run the gitlog-to-changelog script.
These changes were made on the 1.1.x branch. The older 1.0.x branch still has a normal ChangeLog file in the source repository, and when changes are made on that branch and merged into 1.1.x the ChangeLog entries get merged into ChangeLog-OLD automatically (git is fantastic for merging changes across renamed files).
The actual changes are here.