git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Benoit SIGOURE <tsuna@lrde.epita.fr>
To: Bruno Haible <bruno@clisp.org>
Cc: bug-gnulib@gnu.org, git list <git@vger.kernel.org>
Subject: GNU-style ChangeLog merge driver for Git (was: Re: git: avoiding merges, rebasing)
Date: Tue, 9 Oct 2007 20:19:51 +0200	[thread overview]
Message-ID: <BC06CC09-FD81-4153-AA54-A1A74250946B@lrde.epita.fr> (raw)
In-Reply-To: <200710091403.26047.bruno@clisp.org>

[-- Attachment #1: Type: text/plain, Size: 3366 bytes --]

On Oct 9, 2007, at 2:03 PM, Bruno Haible wrote:

> Hello Benoit,
>
> Thanks for working on this. But this merge driver has a few major  
> nits.
>
>
> 1) While my ChangeLog file was locally unmodified but some pulled  
> in commits
>    should modify it, "git pull" stopped and said:
>
> ChangeLog: needs update
> fatal: Entry 'ChangeLog' not uptodate. Cannot merge.
>
> [I cannot swear on this, because I did not do a "git status" before  
> the
> "git pull", but this is in a directory where I usually have no  
> pending diffs.]

I'll check but I'm afraid that Git bails out before actually trying  
the merge driver.

>
> The ChangeLog in question is the one from gnulib
> (git clone git://git.sv.gnu.org/gnulib).
>
>
> 2) This "merge driver" did much more than sorting in a merge: it  
> sorted the
> entire file! In doing so,
>   - It changed the order of ChangeLog entries in a way that does  
> not represent
>     the historical commit order.
>   - For ChangeLog entries with multiple contributors, it shuffled  
> around these
>     extra contributors to other ChangeLog entries.
>   - Near the end of the file, it made a change that I cannot explain.
>
> Find attached a context diff of all the bad changes that it did.
>

Yes, it's pretty stupid, I hacked this in a hurry.  I'll try to  
improve it so that it doesn't have these undesired side-effects.

>
> In my opinion, a merge driver should not do changes to the file except
> in the range of lines where the conflict occurred. For a ChangeLog  
> driver,
> all uncommitted entries should be collected at the top of the file,  
> because
> 1. ChangeLogs are kept in the order of historical commit in the  
> central
>    repository,
> 2. other developers always look at the top of the ChangeLog; if a  
> ChangeLog
>    entries is inserted second or third after some already present  
> entries,
>    the danger is too high that the change gets unnoticed.
>
> So "git-merge-changelog OLD CURRENT OTHERS" should IMO do the  
> following:
> 1) Collect the changes between OLD and HEAD (I don't know if that  
> is CURRENT
>    or OTHERS?), in two categories:
>      - added entries,
>      - changed and removed entries.
> 2) Back out the added entries, keeping only the changed and removed  
> entries
>    as modifications.
> 3) Do a normal merge between this and the pulled in remote branch  
> (I don't
>    know if that is OTHERS or CURRENT?). If that merge gives a  
> conflict,
>    bail out.
> 4) Insert the added entries at the top, in the same order as they were
>    originally (no sorting).
>
> Bruno
> <git-merge-changelog-blunder>

OK I'll try to rework the driver so that it implements this.  It will  
take some time though, I'm quite busy these days.
Akim Demaille would also like it to squash the commits added by the  
merge (the new commits in OTHERS):

YYYY-MM-DD  Author  <who@where.com>

	Merge whatever:

	YYYY-MM-DD  Someone Else  <foo@bar.com>
	Some change.
	* FileChanged.c: Whatever.

	YYYY-MM-DD  Who Cares  <who@cares.com>
	Some other change.
	* OtherFile.c: Do it.

I thought this was mandated by the GNU Coding Standards but I  
checked, it doesn't say anything about merges.  Would this sort of  
strategy be useful to you?  Should it be default (or enabled by some  
--squash option)?

Cheers,

-- 
Benoit Sigoure aka Tsuna
EPITA Research and Development Laboratory



[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 186 bytes --]

  reply	other threads:[~2007-10-09 18:20 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200709301421.52192.bruno@clisp.org>
     [not found] ` <200710020347.43733.bruno@clisp.org>
     [not found]   ` <4AD64749-F4A3-4A61-B1EE-D12523293661@lrde.epita.fr>
     [not found]     ` <200710021350.54625.bruno@clisp.org>
2007-10-02 12:16       ` git: avoiding merges, rebasing Eric Blake
2007-10-03 21:31         ` making "git stash" safer to use Bruno Haible
2007-10-03 21:36           ` Junio C Hamano
2007-10-04  8:40           ` Joachim B Haga
2007-10-04 20:59             ` David Kastrup
2007-10-19 13:37         ` stash clear, was Re: git: avoiding merges, rebasing Johannes Schindelin
2007-10-23  8:55           ` Miles Bader
     [not found]       ` <6C9F1445-8826-4E6F-A10C-290A57A4C826@lrde.epita.fr>
2007-10-03 23:01         ` Bruno Haible
     [not found] ` <46FF99E2.8050605@byu.net>
     [not found]   ` <200709302141.25597.bruno@clisp.org>
     [not found]     ` <C64152A3-A5A6-4320-864C-E78E3A60C8E6@lrde.epita.fr>
2007-10-08 13:16       ` Benoit SIGOURE
2007-10-08 13:17       ` Benoit SIGOURE
2007-10-09 10:43         ` Johannes Schindelin
2007-10-09 18:06           ` Benoit SIGOURE
2007-10-09 12:03         ` Bruno Haible
2007-10-09 18:19           ` Benoit SIGOURE [this message]
2007-10-09 19:38             ` GNU-style ChangeLog merge driver for Git Bruno Haible

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=BC06CC09-FD81-4153-AA54-A1A74250946B@lrde.epita.fr \
    --to=tsuna@lrde.epita.fr \
    --cc=bruno@clisp.org \
    --cc=bug-gnulib@gnu.org \
    --cc=git@vger.kernel.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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).