From: Linus Torvalds <torvalds@osdl.org>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: git@vger.kernel.org
Subject: Re: path limiting broken
Date: Sun, 16 Apr 2006 09:06:28 -0700 (PDT) [thread overview]
Message-ID: <Pine.LNX.4.64.0604160850230.3701@g5.osdl.org> (raw)
In-Reply-To: <Pine.LNX.4.63.0604161411120.15345@wbgn013.biozentrum.uni-wuerzburg.de>
On Sun, 16 Apr 2006, Johannes Schindelin wrote:
>
> I am not intelligent enough to find out why there are three revisions
> which get culled.
>
> Ideas?
Path limiting by default looks at all parents of a merge, and if any of
them is identical to the child (within the path limiter), it will pick
_that_ parent, and that parent only, and drop all other parents.
(If there are multiple identical parents, it will pick the first one).
For example, if you do
HEAD
|
a
/ \
b c
| /|
| / d
|/ |
e f
| /
g /
|/
h
and the file was modified in commit "b" and nowhere else, then think about
what the final history should look like.. Since it was modified in "b",
it's going to be the same in "a" and "b", so the path limiting will
totally drop the whole "c" subtree, and will only ever look at the tree
a->b->e->g->h.
After that, it will simplify the history by dropping commits that don't
change the path, and the whole history will end up being just "b".
Which is exactly what you want.
Now, realize that if the exact _same_ change is done in "f", the same
thing will happen. "f" will never be shown, because "f" simply isn't
interesting. We picked up the same change in "b", and while the merge "a"
had _both_ parents identical in the file, it would pick only the first
one. So we'll never even _look_ at "f".
Now, this is _important_. Pruning merges is really fundamental to giving a
reasonable file history, and not just a performance optimization. If the
same change came from two branches, we really don't care who did it: we'll
hit _one_ of the changes even after pruning. But yes, it could miss the
other one.
Here's a patch to show what an unpruned history ends up looking like.
With this patch applied, try the following:
gitk -- ls-tree.c &
gitk --no-prune-merges -- ls-tree.c &
and compare the two. You'll see _immediately_ why I think merge pruning is
not just a good idea, it's something we _have_ to do.
Linus
----
diff --git a/revision.c b/revision.c
index 0505f3f..25338b6 100644
--- a/revision.c
+++ b/revision.c
@@ -291,7 +291,7 @@ static void try_to_simplify_commit(struc
parse_commit(p);
switch (rev_compare_tree(revs, p->tree, commit->tree)) {
case REV_TREE_SAME:
- if (p->object.flags & UNINTERESTING) {
+ if (revs->no_merge_pruning || (p->object.flags & UNINTERESTING)) {
/* Even if a merge with an uninteresting
* side branch brought the entire change
* we are interested in, we do not want
@@ -640,6 +640,10 @@ int setup_revisions(int argc, const char
revs->unpacked = 1;
continue;
}
+ if (!strcmp(arg, "--no-prune-merges")) {
+ revs->no_merge_pruning = 1;
+ continue;
+ }
*unrecognized++ = arg;
left++;
continue;
diff --git a/revision.h b/revision.h
index 8970b57..a116305 100644
--- a/revision.h
+++ b/revision.h
@@ -26,6 +26,7 @@ struct rev_info {
/* Traversal flags */
unsigned int dense:1,
no_merges:1,
+ no_merge_pruning:1,
remove_empty_trees:1,
lifo:1,
topo_order:1,
next prev parent reply other threads:[~2006-04-16 16:06 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-16 12:26 path limiting broken Johannes Schindelin
2006-04-16 16:06 ` Linus Torvalds [this message]
2006-04-16 16:45 ` Johannes Schindelin
2006-04-16 17:07 ` Linus Torvalds
2006-04-16 17:27 ` path limiting broken (NOT) Johannes Schindelin
2006-04-16 17:39 ` path limiting broken Johannes Schindelin
2006-04-16 17:58 ` Linus Torvalds
2006-04-16 18:09 ` Johannes Schindelin
2006-04-16 18:27 ` Linus Torvalds
2006-04-16 23:49 ` Johannes Schindelin
2006-04-17 2:48 ` Linus Torvalds
2006-04-16 17:05 ` Johannes Schindelin
2006-04-16 17:51 ` Linus Torvalds
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=Pine.LNX.4.64.0604160850230.3701@g5.osdl.org \
--to=torvalds@osdl.org \
--cc=Johannes.Schindelin@gmx.de \
--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 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).