git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Rast <trast@student.ethz.ch>
To: "Dale R. Worley" <worley@alum.mit.edu>
Cc: Junio C Hamano <gitster@pobox.com>, <git@vger.kernel.org>
Subject: Re: What I want rebase to do
Date: Thu, 7 Mar 2013 09:48:29 +0100	[thread overview]
Message-ID: <87r4jra942.fsf@pctrast.inf.ethz.ch> (raw)
In-Reply-To: <201303061855.r26ItKtM018797@freeze.ariadne.com> (Dale R. Worley's message of "Wed, 6 Mar 2013 13:55:20 -0500")

worley@alum.mit.edu (Dale R. Worley) writes:
[...snip...]

Isn't that just a very long-winded way of restating what Junio said
earlier:

> > It was suggested to make it apply the first-parent diff and record
> > the result, I think.  If that were an acceptable approach (I didn't
> > think about it through myself, though), that would automatically
> > cover the evil-merge case as well.

You can fake that with something like

git rev-list --first-parent --reverse RANGE_TO_REBASE |
while read rev; do
    if git rev-parse $rev^2 >/dev/null 2>&1; then
        git cherry-pick -n -m1 $rev
        git rev-parse $rev^2 >.git/MERGE_HEAD
        git commit -C$rev
    else
        git cherry-pick $rev
    fi
done

Only tested very lightly.  Dealing with octopii, conflicts and actually
preserving the commit's attributes is left as an exercise to the
reader[1].

I still think that the _right_ solution is first redoing the merge on
its original parents and then seeing how the actual merge differs from
that.  --preserve-merges has bigger issues though, like Junio said.

Perhaps a new option to git-rebase could trigger the above behavior for
merges, who knows.  (It could be called --first-parent.)


[1]  If you don't get the sarcasm: that would amount to reinventing
large parts of git-rebase.

-- 
Thomas Rast
trast@{inf,student}.ethz.ch

  reply	other threads:[~2013-03-07  8:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-04 20:58 "git rebase" loses the additional changes in "evil" merges Dale R. Worley
2013-03-04 21:18 ` Junio C Hamano
2013-03-04 21:24   ` Thomas Rast
2013-03-04 21:41     ` Junio C Hamano
2013-03-06 18:55       ` What I want rebase to do Dale R. Worley
2013-03-07  8:48         ` Thomas Rast [this message]
2013-03-07 10:08           ` Johannes Sixt
2013-03-07 17:38           ` Junio C Hamano
2013-03-07 22:06           ` Dale R. Worley
2013-03-05 21:18   ` "git rebase" loses the additional changes in "evil" merges Dale Worley
2013-03-05 21:35     ` Junio C Hamano
2013-03-05 23:16       ` Philip Oakley
2013-03-05 23:31         ` 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=87r4jra942.fsf@pctrast.inf.ethz.ch \
    --to=trast@student.ethz.ch \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=worley@alum.mit.edu \
    /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 NNTP newsgroup(s).