GIT-MERGE-CHANGELOG(1) | User Contributed Perl Documentation | GIT-MERGE-CHANGELOG(1) |
git-merge-changelog - git merge driver for GNU ChangeLog files
The default merge driver of 'git' always produces conflicts when pulling public modifications into a privately modified ChangeLog file. This is because ChangeLog files are always modified at the top; the default merge driver has no clue how to deal with this. Furthermore the conflicts are presented with more <<<< ==== >>>> markers than necessary; this is because the default merge driver makes pointless efforts to look at the individual line changes inside a ChangeLog entry.
This program serves as a 'git' merge driver that avoids these problems.
[merge "merge-changelog"] name = GNU-style ChangeLog merge driver driver = /usr/bin/git-merge-changelog %O %A %B
ChangeLog merge=merge-changelog
(See "man 5 gitattributes" for more info.)
external_merge = git-merge-changelog %b %T %o
$ bzr extmerge ChangeLog
[merge-patterns] ChangeLog = git-merge-changelog [merge-tools] git-merge-changelog.executable = /usr/bin/git-merge-changelog git-merge-changelog.args = $base $local $other
See <http://www.selenic.com/mercurial/hgrc.5.html> section merge-tools for reference.
git-merge-changelog performs the same role as "diff3 -m", just with reordered arguments:
$ git-merge-changelog %O %A %B
is comparable to
$ diff3 -m %A %O %B
A merge driver is called with three filename arguments:
In case of a "git stash apply" or of an upstream pull (e.g. from a subsystem maintainer to a central maintainer) or of a downstream pull with --rebase:
In case of a downstream pull (e.g. from a central repository to the user) or of an upstream pull with --rebase:
It should write its merged output into file %A. It can also echo some remarks to stdout. It should exit with return code 0 if the merge could be resolved cleanly, or with non-zero return code if there were conflicts.
The structure of a ChangeLog file: It consists of ChangeLog entries. A ChangeLog entry starts at a line following a blank line and that starts with a non-whitespace character, or at the beginning of a file. The merge driver works as follows: It reads the three files into memory and dissects them into ChangeLog entries. It then finds the differences between %O and %B. They are classified as:
The driver then attempts to apply the changes to %A. To this effect, it first computes a correspondence between the entries in %O and the entries in %A, using fuzzy string matching to still identify changed entries.
The git-merge-changelog author and maintainer is Bruno Haible.
This man page was adapted by Ian Beckwith from the comments at the top of git-merge-changelog.c.
git-merge-changelog is part of the GNU gnulib project.
Gnulib home page: <http://www.gnu.org/software/gnulib/>
Copyright (C) 2008-2010 Bruno Haible <bruno@clisp.org>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>
2023-02-24 | perl v5.36.0 |