git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: Catalin Marinas <catalin.marinas@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: StGIT and rerere
Date: Thu, 26 Oct 2006 10:21:55 -0700	[thread overview]
Message-ID: <7vfydbkn64.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: tnxu01r2fzv.fsf@arm.com

Catalin Marinas <catalin.marinas@arm.com> writes:

> I didn't know it exists. I've been thinking at a way to avoid
> duplicating the conflict fixing but haven't got to any results. This
> looks like a good idea.
> ...
> My problem was with maintaining a public branch where re-basing
> patches is not welcomed but I would still like to use StGIT in my
> development branch. When pulling from upstream in my devel branch, I
> get conflicts in some patches. The problem is that I get the same
> conflicts in the patches already merged in the public branch where the
> patches were previously checked in.
>
> Another case is several branches with common patches that generate
> conflicts.
> ...
> Note, however, that I haven't looked at how git-rerere works and I
> might have misunderstood its functionality.

I think Documentation/git-rerere.txt describes its operation in
enough details for the end user, but if there is anything
unclear please ask away.

There are two details that are not mentoined in the end-user
documentation.

* Identifying "same" conflicts.

This is done by hashing the text inside the conflict markers:

	<<<<<<<
        a
        =======
	b
        >>>>>>>

Each conflicted section like the above are first canonicalized
so that section "a" sorts alphabetically earlier than section
"b" (in other words, if the conflict were <<< b === a >>> then
they are swapped to read <<< a === b >>>), concatenated and fed
into SHA-1 digest.  The final digest after conflicted file is
read as a whole becomes the name of the conflict, and naming is
done per file.

The reason for this canonicalization is because the order in the
conflicted section depends on the direction of the merge (if
you pull test into master you get the conflict marked the other
way from the case you pulled master into test).

* rerere's resolution can affect outside conflict markers.

If an earlier conflict read like this:

	...
	z
	<<<<<<<
        a
        =======
        b
        >>>>>>>
        c
	d
	e
        f
        g
	...
        
and your earlier resolution was like this:

	...
	w
        b
        dd
        e
        f
        g
	...

That is what rerere records (i.e. including removal of c and
change from z to w).

Then, when you see the same conflict like this (notice that g is
now h):

	...
	z
	<<<<<<<
        a
        =======
        b
        >>>>>>>
        c
	d
	e
        f
        h
	...

it is resolved like this:

	...
	w
        b
        d
        e
        f
        h
	...

This is often useful when e.g. a <<< === >>> section changes
function signature of a (static) function; parts outside the
conflicted section needs matching changes to adjust to it and
that is recorded and replayed by rerere.

      reply	other threads:[~2006-10-26 17:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-20 22:39 StGIT and rerere Robin Rosenberg
2006-10-26 16:34 ` Catalin Marinas
2006-10-26 17:21   ` Junio C Hamano [this message]

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=7vfydbkn64.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=catalin.marinas@gmail.com \
    --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).