From: "Shawn O. Pearce" <spearce@spearce.org>
To: Jakub Narebski <jnareb@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Some ideas for StGIT
Date: Sat, 4 Aug 2007 22:31:30 -0400 [thread overview]
Message-ID: <20070805023130.GV20052@spearce.org> (raw)
In-Reply-To: <f934ve$3oi$1@sea.gmane.org>
Jakub Narebski <jnareb@gmail.com> wrote:
> Shawn O. Pearce wrote:
>
> > (Regarding the performance, cherry-picking 55 patches is
> > slow, especially when many of them would apply trivially with
> > git-diff|git-apply --index. Be nice to improve that in 1.5.4.)
>
> Perhaps in the future you would be able to use -i/--interactive mode
> in merge driven git-rebase (git rebase --merge -i <base>), which I think
> should be faster.
Heh. You're talking to someone who actually knows what he is talking
about here, and was actually involved in some of these tools...
Let me fill the reader in on what's really happening...
`git-rebase` (non -i, non -m) uses `format-patch|am` to apply the
changes of each commit it is rebasing. This is insanely fast as
builtin diff and apply routines are quite efficient. It sometimes
fails due to patches not applying cleanly. In those cases you
have to either hand edit the patch, apply and continue the rebase,
or abort the rebase and restart with the -m flag so it uses a full
three-way file merge.
`git-rebase -m` (aka --merge) uses git-merge-recursive to apply the
changes of each commit it is rebasing. (That's the merge part!)
However merge-recursive usually takes longer to run then the above
`format-patch|am` pipeline, and that is why -m is not the default.
But it does handle cases `format-patch|am` cannot do automatically.
For quite a long time now both `git-revert` and `git-cherry-pick`
(which are actually the same program!) have also been using
git-merge-recursive as their implementation to revert or apply the
commit's change. This allows them to perform changes that also
involve renames, as well as to apply some changes that might fail
as a patch but succeed when done as a three-way file merge.
So really `revert`, `cherry-pick`, `rebase -m` (and also `am -3`
as it also uses merge-recursive) are all the same underlying
implementation. The major differences between them is what they
do *after* the changes have been applied, and which direction the
change goes (e.g. revert undoes the change).
Now the new `git-rebase -i` is really just a complicated loop around
`cherry-pick`. Really. Go look at the code, it never calls anything
except cherry-pick. So `rebase -i` is actually `rebase --merge -i`.
That's why its sluggish.
Why is merge-recursive sluggish? It does rename detection.
It does full three-way file merges, rather than just applying
a patch. It also tries to do a three-way read-tree before doing
file level merges. git-apply does none of these things, and is
faster because of it.
So that future you speak of above is today. Its also not faster,
its slower. Faster would be to do something like `format-patch|am -3`
so that merge-recursive is only invoked if git-apply was unable to
apply the patch automatically. Except we'd want to save the original
tree data so we can do proper rename detection when merge-recursive
is fired up.
--
Shawn.
next prev parent reply other threads:[~2007-08-05 2:31 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-03 17:50 Some ideas for StGIT Pavel Roskin
2007-08-03 18:14 ` Andy Parkins
2007-08-04 5:41 ` Pavel Roskin
2007-08-04 5:51 ` Shawn O. Pearce
2007-08-05 0:08 ` Pavel Roskin
2007-08-05 0:17 ` Jakub Narebski
2007-08-05 2:31 ` Shawn O. Pearce [this message]
2007-08-05 3:32 ` Junio C Hamano
2007-08-05 13:39 ` Josef Sipek
2007-08-05 13:56 ` Johannes Schindelin
2007-08-05 14:06 ` Josef Sipek
2007-08-05 14:15 ` Johannes Schindelin
2007-08-05 14:57 ` Josef Sipek
2007-08-04 8:08 ` Yann Dirson
2007-08-06 10:01 ` Catalin Marinas
2007-08-04 14:14 ` Chris Shoemaker
2007-08-04 15:22 ` Johannes Schindelin
2007-08-03 23:23 ` Yann Dirson
2007-08-06 9:49 ` Catalin Marinas
2007-08-06 13:26 ` Pavel Roskin
2007-08-06 15:19 ` Josef Sipek
2007-08-04 6:38 ` Theodore Tso
2007-08-04 8:16 ` Yann Dirson
2007-08-04 21:35 ` Josef Sipek
2007-08-05 0:12 ` Pavel Roskin
2007-08-06 9:36 ` Catalin Marinas
2007-08-06 9:56 ` Karl Hasselström
2007-08-06 12:42 ` Pavel Roskin
2007-08-06 13:52 ` Karl Hasselström
2007-08-23 14:09 ` Catalin Marinas
2007-08-23 14:34 ` Karl Hasselström
2007-08-06 17:17 ` Pavel Roskin
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=20070805023130.GV20052@spearce.org \
--to=spearce@spearce.org \
--cc=git@vger.kernel.org \
--cc=jnareb@gmail.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 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.