From: Avery Pennarun <apenwarr@gmail.com>
To: Jon Seymour <jon.seymour@gmail.com>
Cc: Jeff King <peff@peff.net>, Git Mailing List <git@vger.kernel.org>
Subject: Re: RFD: best way to automatically rewrite a git DAG as a linear history?
Date: Thu, 18 Feb 2010 22:13:45 -0500 [thread overview]
Message-ID: <32541b131002181913t24989addr84b612787a2f8c48@mail.gmail.com> (raw)
In-Reply-To: <2cfc40321002181704i73eb87demd03faaddf9bb108@mail.gmail.com>
On Thu, Feb 18, 2010 at 8:04 PM, Jon Seymour <jon.seymour@gmail.com> wrote:
> Avery's script almost does what I need, except the rewritten diffs
> corresponding to the merge commits introduces unnecessary noise (from
> upstream deltas) in the series and potentially complicate eventual
> merges of the linear history back into the upstream.
You're never going to get the "linear" history merged back upstream
until you fix the inconsistencies. At least, no sensible upstream
should accept the patches.
Using the linearization mechanism you propose, you end up producing a
false history: one in which, other than at certain checkpoints, the
code doesn't even work. What's the point of such a history? It
neither reflects the true development history (ie. pre-linearization)
nor a more useful, idealized version of history (ie. one that compiles
at every point and adds features in a rational order and is useful for
git bisect).
It doesn't even provide something useful for patch review, since half
your patches will have randomly-selected conflict resolutions (ie.
changes to unrelated code that never should have changed) thrown in.
You'd be better off reviewing patches from the original history, and
just ignoring merge commits, which is what 'git format-patch' or just
'git log -p' would do automatically.
The result is also still not suitable for submission upstream: the
sync points (where the files actually match what the developer had in
his tree) are the only places where the code is even likely to
compile, and yet they *also* include all the code brought in by prior
merges, which you already said include code that shouldn't go
upstream.
The linearization script I gave you at least has these interesting
characteristics:
- If the original history compiled at every point, then the linearized
history does too.
- It is an accurate representation of the successive states of the
tree experienced by the original developer.
- You can use 'git rebase' to incrementally rearrange and combine
patches until they make enough sense to submit upstream.
- It is easy to separate out merges (which usually don't need patch
review) from individual patches (which do).
- If some merges added useless code, you can remove them completely
with rebase by just removing a single patch from the list.
Of course, even with this script, it will still take work (rebasing)
to produce code that's polished and ready to go upstream. But I'm not
sure there's a way to automate that without producing interim versions
that are much, much worse.
Have fun,
Avery
next prev parent reply other threads:[~2010-02-19 3:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-18 2:35 RFD: best way to automatically rewrite a git DAG as a linear history? Jon Seymour
2010-02-18 5:11 ` Jeff King
2010-02-18 18:38 ` Avery Pennarun
2010-02-19 1:04 ` Jon Seymour
2010-02-19 3:13 ` Avery Pennarun [this message]
2010-02-19 7:29 ` Jon Seymour
2010-02-19 20:20 ` Avery Pennarun
2010-02-20 2:25 ` Jon Seymour
2010-02-20 3:05 ` Avery Pennarun
2010-02-21 23:04 ` Jon Seymour
2010-02-21 23:18 ` Jon Seymour
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=32541b131002181913t24989addr84b612787a2f8c48@mail.gmail.com \
--to=apenwarr@gmail.com \
--cc=git@vger.kernel.org \
--cc=jon.seymour@gmail.com \
--cc=peff@peff.net \
/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).