@matheusbsbs / matheus-bagliano / commits / c348f31ab9
Fork 0

revision traversal: --remove-empty fix (take #2).

Marco Costalba reports that --remove-empty omits the commit that created paths we are interested in. try_to_simplify_commit() logic was dropping a parent we introduced those paths against, which I think is not what we meant. Instead, this makes such parent parentless. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Mar 12, 2006 at 13:39 UTC c348f31ab9d8f695aef405d9981b85c943a5875a
1 file changed +9 -5
revision.c
+9 -5
@@ -317,12 +317,16 @@ static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit)
317 case TREE_NEW:
318 if (revs->remove_empty_trees &&
319 same_tree_as_empty(p->tree)) {
320 - /* We are adding all the specified paths from
321 - * this parent, so the parents of it is
322 - * not interesting, but the difference between
323 - * this parent and us still is interesting.
320 + /* We are adding all the specified
321 + * paths from this parent, so the
322 + * history beyond this parent is not
323 + * interesting. Remove its parents
324 + * (they are grandparents for us).
325 + * IOW, we pretend this parent is a
326 + * "root" commit.
327 */
325 - p->object.flags |= UNINTERESTING;
328 + parse_commit(p);
329 + p->parents = NULL;
330 }
331 /* fallthrough */
332 case TREE_DIFFERENT: