All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Fedor Sergeev <Fedor.Sergeev@Sun.COM>
Cc: Roman.Shaposhnick@Sun.COM, git@vger.kernel.org
Subject: Re: overly smart rebase - bug or feature?
Date: Mon, 10 Nov 2008 15:14:42 -0800	[thread overview]
Message-ID: <7vod0n41i5.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <20081110212333.GU6799@sun.com> (Fedor Sergeev's message of "Tue, 11 Nov 2008 00:23:34 +0300")

Fedor Sergeev <Fedor.Sergeev@Sun.COM> writes:

> I have recently hit a behavior which might well be a feature, 
> but it was very surprising (in a bad sense) to me.

It is a feature misfiring.

Rebase is essentially a repeated cherry-pick, and a cherry-pick of commit
A on top of commit B is done by a simplified 3-way merge between A and B
using the parent of A as the common ancestor.

     A                          A'
    /                          /
   A^... pseudo history ...---B

When your history has renamed Makefile to Makefile2 (thereby losing
Makefile) while transition from A^ to A modified Makefile, the difference
between A^ to A that is applied to B to produce A' contains only the
change about Makefile (and does not talk about the unchangedness of
Makefile1 nor Makefile2 --- in fact, when A' is created, the machinery
does not even know if A^ and A had Makefile1 or Makefile2).

When applying the change to Makefile, it notices that B does not have
Makefile, but there is a path that is _identical_ to the preimage your
change applies to (namely, Makefile2).  To support people who rename
Makefile to Makefile2 in the history that led to B, rebase (actually the
underlying "am -3" it calls is where this rename detection smart lies)
applies the changes to the "renamed" path.

You might be able to work this around by forcing rebase not to use the
simplified 3-way merge, by saying "rebase -m".

  reply	other threads:[~2008-11-10 23:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-10 21:23 overly smart rebase - bug or feature? Fedor Sergeev
2008-11-10 23:14 ` Junio C Hamano [this message]
2008-11-10 23:31   ` Avery Pennarun
2008-11-10 23:36   ` Fedor Sergeev
2008-11-10 23:57     ` Junio C Hamano
2008-11-12 21:39   ` Fedor Sergeev
2008-11-12 22:04     ` Junio C Hamano

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=7vod0n41i5.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=Fedor.Sergeev@Sun.COM \
    --cc=Roman.Shaposhnick@Sun.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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.