ChangeLog management tip
Tom Tromey
tromey@redhat.com
Fri Oct 25 19:49:00 GMT 2013
I spent a good chunk of today figuring out how I would manage ChangeLog
files in the new all-git world. For me this underscores how we ought to
just get rid of them; but I realize from previous discussions that this
probably won't happen, so I tried to get along.
My main goal is to preserve two nice features of git: "git send-email"
and "git merge"; while also following the gdb rules about having the
ChangeLog entry in the commit message and about not sending the
ChangeLog entry as part of the patch.
What I came up with is reasonably ugly, but at least it satisfies the
above.
First, follow the instructions for installing git-merge-changelog:
http://gnu.wildebeest.org/blog/mjw/2012/03/16/automagically-merging-changelog-files-with-mercurial-or-git/
This will let you do step 1, which is to always write ChangeLog entries
in the correct files in the source tree.
Next, put the prepare-commit-msg script, attached, into your .git/hooks.
This script will update your commit message with the contents of any
ChangeLog files you have edited.
Normally it does the right thing. However of course you ought to
double-check it.
The idea here is that gdb rules require double-transcription of the
ChangeLog entries. My approach makes the files the canonical source,
and the commit message derived from those.
This adds a little line saying "~ChangeLog~" to the commit message.
I trust nobody will care.
Then, add this to your .git/config:
[diff "changelog"]
command = /bin/true
This defines an external diff command that we'll use when sending email.
To do this, put the attached git-gdb-email script into your PATH
somewhere.
Then, instead of "git send-email", use "git gdb-email".
This will arrange for ChangeLog diffs to be dropped from your patch.
I think the only thing that remains is having a nice way to update the
dates at the top of ChangeLog entries. I may write a wrapper for git
filter-branch that knows how to do this.
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: prepare-commit-msg
Type: application/octet-stream
Size: 1402 bytes
Desc: prepare-commit-msg
URL: <http://sourceware.org/pipermail/gdb/attachments/20131025/d4c81c10/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: git-gdb-email
Type: application/octet-stream
Size: 264 bytes
Desc: git-gdb-email
URL: <http://sourceware.org/pipermail/gdb/attachments/20131025/d4c81c10/attachment-0001.obj>
More information about the Gdb
mailing list