ChangeLog management tip

Tom Tromey <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <[email protected]>
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
prepare-commit-msg (application/octet-stream, 1.4 KB) - not displayed
git-gdb-email (application/octet-stream, 264 B) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.