diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2007-11-12 23:16:08 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2007-11-14 03:59:37 -0800 |
commit | 7dc0fe3be5c949e83e96a1b829be0e72eafffb47 (patch) | |
tree | 5e4d44177d7c91e3dd2bb23d126160c1f66cb693 /revision.c | |
parent | 53b2c823f6e862e0c83a4a25bab43e8c32e9c289 (diff) | |
download | git-7dc0fe3be5c949e83e96a1b829be0e72eafffb47.tar.gz |
Fix parent rewriting in --early-output
We cannot tell a node that has been checked and found not to be
interesting (which does not have the TREECHANGE flag) from a
node that hasn't been checked if it is interesting or not,
without relying on something else, such as object->parsed.
But an object can get the "parsed" flag for other reasons.
Which means that "TREECHANGE" has the wrong polarity.
This changes the way how the path pruning logic marks an
uninteresting commits. From now on, we consider a commit
interesting by default, and explicitly mark the ones we decided
to prune. The flag is renamed to "TREESAME".
Then, this fixes the logic to show the early output with
incomplete pruning. It basically says "a commit that has
TREESAME set is kind-of-UNINTERESTING", but obviously in a
different way than an outright UNINTERESTING commit. Until we
parse and examine enough parents to determine if a commit
becomes surely "kind-of-UNINTERESTING", we avoid rewriting
the ancestry so that later rounds can fix things up.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'revision.c')
-rw-r--r-- | revision.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/revision.c b/revision.c index 931f978af9..5796153bbd 100644 --- a/revision.c +++ b/revision.c @@ -311,17 +311,15 @@ static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit) /* * If we don't do pruning, everything is interesting */ - if (!revs->prune) { - commit->object.flags |= TREECHANGE; + if (!revs->prune) return; - } if (!commit->tree) return; if (!commit->parents) { - if (!rev_same_tree_as_empty(revs, commit->tree)) - commit->object.flags |= TREECHANGE; + if (rev_same_tree_as_empty(revs, commit->tree)) + commit->object.flags |= TREESAME; return; } @@ -329,10 +327,8 @@ static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit) * Normal non-merge commit? If we don't want to make the * history dense, we consider it always to be a change.. */ - if (!revs->dense && !commit->parents->next) { - commit->object.flags |= TREECHANGE; + if (!revs->dense && !commit->parents->next) return; - } pp = &commit->parents; while ((parent = *pp) != NULL) { @@ -357,6 +353,7 @@ static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit) } parent->next = NULL; commit->parents = parent; + commit->object.flags |= TREESAME; return; case REV_TREE_NEW: @@ -385,7 +382,8 @@ static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit) die("bad tree compare for commit %s", sha1_to_hex(commit->object.sha1)); } if (tree_changed && !tree_same) - commit->object.flags |= TREECHANGE; + return; + commit->object.flags |= TREESAME; } static int add_parents_to_list(struct rev_info *revs, struct commit *commit, struct commit_list **list) @@ -1354,7 +1352,9 @@ static enum rewrite_result rewrite_one(struct rev_info *revs, struct commit **pp return rewrite_one_error; if (p->parents && p->parents->next) return rewrite_one_ok; - if (p->object.flags & (TREECHANGE | UNINTERESTING)) + if (p->object.flags & UNINTERESTING) + return rewrite_one_ok; + if (!(p->object.flags & TREESAME)) return rewrite_one_ok; if (!p->parents) return rewrite_one_noparents; @@ -1427,7 +1427,7 @@ enum commit_action simplify_commit(struct rev_info *revs, struct commit *commit) return commit_ignore; if (revs->prune && revs->dense) { /* Commit without changes? */ - if (!(commit->object.flags & TREECHANGE)) { + if (commit->object.flags & TREESAME) { /* drop merges unless we want parenthood */ if (!revs->parents) return commit_ignore; |