public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Samuel Bronson <naesten@gmail.com>
To: Pedro Alves <palves@redhat.com>
Cc: binutils@sourceware.org,  gcc-patches@gcc.gnu.org,
	 gdb-patches@sourceware.org
Subject: [COMMIT] Add a .gitattributes file for use with git-merge-changelog
Date: Fri, 25 Jul 2014 22:40:00 -0000	[thread overview]
Message-ID: <87r4195ag3.fsf_-_@naesten.mooo.com> (raw)
In-Reply-To: <53BBB0D7.9010908@redhat.com> (Pedro Alves's message of "Tue, 08	Jul 2014 09:50:31 +0100")

Individual users will still have to:

 1. Install git-merge-changelog

 2. Set up the merge driver in their git config

See gnulib's lib/git-merge-changelog.c [1] for details.

For example, I:

 1. Patched Debian's gnulib package to build git-merge-changelog, and
    sent the patch to the Debian maintainer, who then proceeded to not
    only accept my patch but even write a *manpage* for
    git-merge-changelog! (Let's hear it for Ian Beckwith.)

    So now, I can install it simply by running "apt-get install
    git-merge-changelog".  (Except, of course, that I already have it
    installed from when I was testing my patch.)

 2. Did step (2) from .gitattributes

With this patch applied and the above two steps done by whatever means
you deem best, you can say goodbye to merge conflicts in ChangeLog
files -- at least *IF* people stop renaming the danged things, anyway.

If you don't do step 2, you will continue to suffer from ChangeLog
merge conflicts exactly as before, whether or not you did step 1.

If you do step 2 but not step 1, git will likely start complaining
that it can't find any "git-merge-changelog" to run.

[1]: http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob;f=lib/git-merge-changelog.c

[Note: The docs for git-merge-changelog (the comments at the top) say
that you need a .gitattributes in every directory.  The docs are wrong.
Ignore the docs.  Well, not the whole docs; just that part.

You really only need one at the top level, since .gitattributes uses
the same pattern matching rules as .gitignore, which match files in
any subdirectory unless you prefix the pattern with a "/", as
explained in the gitignore(5) manpage.]
---
 .gitattributes | 20 ++++++++++++++++++++
 ChangeLog      |  4 ++++
 2 files changed, 24 insertions(+)
 create mode 100644 .gitattributes

diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..06d51d2
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,20 @@
+# -*- conf -*-
+
+## Set merge driver for ChangeLog files 
+# See gnulib's lib/git-merge-changelog.c (or git-merge-changelog(1))
+# for per-user setup instructions.
+#
+# The short version of this (optional) procedure is:
+# 
+# (1) Install git-merge-changelog (this is the tricky part!)
+#
+# (2) Add something like the following to your ~/.gitconfig:
+#
+# [merge "merge-changelog"]
+#         name = GNU-style ChangeLog merge driver
+#         driver = git-merge-changelog %O %A %B
+#
+# (3) Enjoy mostly effortless ChangeLog merges, at least until the
+#     file gets renamed again ...
+
+ChangeLog       merge=merge-changelog
diff --git a/ChangeLog b/ChangeLog
index 16047d3..5c8fe15 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2014-07-25  Samuel Bronson  <naesten@gmail.com>
+
+	* .gitattributes: New file for use with git-merge-changelog.
+
 2014-07-21  Joel Sherrill  <joel.sherrill@oarcorp.com>
 
 	Disable gdb for or1k*-*-* until supported
-- 
2.0.1

  reply	other threads:[~2014-07-25 22:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-20  2:28 [RFC] " Samuel Bronson
2014-06-20 14:08 ` Tom Tromey
2014-06-20 23:02   ` Samuel Bronson
2014-06-28 23:41     ` Samuel Bronson
2014-07-08  1:36       ` Samuel Bronson
2014-07-08  8:50         ` Pedro Alves
2014-07-25 22:40           ` Samuel Bronson [this message]
2014-06-28  5:11 ` Samuel Bronson
2014-06-28 23:24   ` Samuel Bronson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r4195ag3.fsf_-_@naesten.mooo.com \
    --to=naesten@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).