From 2ce406ccb85c4546b6d19309a6101b37c7bd952e Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 30 Oct 2014 12:20:44 -0700 Subject: get_merge_bases(): always clean-up object flags The callers of get_merge_bases() can choose to leave object flags used during the merge-base traversal by passing cleanup=0 as a parameter, but in practice a very few callers can afford to do so (namely, "git merge-base"), as they need to compute merge base in preparation for other processing of their own and they need to see the object without contaminate flags. Change the function signature of get_merge_bases_many() and get_merge_bases() to drop the cleanup parameter, so that the majority of the callers do not have to say ", 1" at the end. Give a new get_merge_bases_many_dirty() API to support only a few callers that know they do not need to spend cycles cleaning up the object flags. Signed-off-by: Junio C Hamano --- revision.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'revision.c') diff --git a/revision.c b/revision.c index 2571ada6bf..07a8ca1ac6 100644 --- a/revision.c +++ b/revision.c @@ -1383,7 +1383,7 @@ static void prepare_show_merge(struct rev_info *revs) other = lookup_commit_or_die(sha1, "MERGE_HEAD"); add_pending_object(revs, &head->object, "HEAD"); add_pending_object(revs, &other->object, "MERGE_HEAD"); - bases = get_merge_bases(head, other, 1); + bases = get_merge_bases(head, other); add_rev_cmdline_list(revs, bases, REV_CMD_MERGE_BASE, UNINTERESTING | BOTTOM); add_pending_commit_list(revs, bases, UNINTERESTING | BOTTOM); free_commit_list(bases); @@ -1488,7 +1488,7 @@ int handle_revision_arg(const char *arg_, struct rev_info *revs, int flags, unsi : lookup_commit_reference(b_obj->sha1)); if (!a || !b) goto missing; - exclude = get_merge_bases(a, b, 1); + exclude = get_merge_bases(a, b); add_rev_cmdline_list(revs, exclude, REV_CMD_MERGE_BASE, flags_exclude); -- cgit v1.2.3