diff options
author | Junio C Hamano <gitster@pobox.com> | 2014-10-30 12:20:44 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-10-30 12:51:10 -0700 |
commit | 2ce406ccb85c4546b6d19309a6101b37c7bd952e (patch) | |
tree | ed00f07eab627dc4217ac76e38a652201f99aac2 /commit.c | |
parent | bisect: clean flags after checking merge bases (diff) | |
download | tgif-2ce406ccb85c4546b6d19309a6101b37c7bd952e.tar.xz |
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 <gitster@pobox.com>
Diffstat (limited to 'commit.c')
-rw-r--r-- | commit.c | 29 |
1 files changed, 21 insertions, 8 deletions
@@ -883,7 +883,7 @@ struct commit_list *get_octopus_merge_bases(struct commit_list *in) for (j = ret; j; j = j->next) { struct commit_list *bases; - bases = get_merge_bases(i->item, j->item, 1); + bases = get_merge_bases(i->item, j->item); if (!new) new = bases; else @@ -952,10 +952,10 @@ static int remove_redundant(struct commit **array, int cnt) return filled; } -struct commit_list *get_merge_bases_many(struct commit *one, - int n, - struct commit **twos, - int cleanup) +static struct commit_list *get_merge_bases_many_0(struct commit *one, + int n, + struct commit **twos, + int cleanup) { struct commit_list *list; struct commit **rslt; @@ -998,10 +998,23 @@ struct commit_list *get_merge_bases_many(struct commit *one, return result; } -struct commit_list *get_merge_bases(struct commit *one, struct commit *two, - int cleanup) +struct commit_list *get_merge_bases_many(struct commit *one, + int n, + struct commit **twos) +{ + return get_merge_bases_many_0(one, n, twos, 1); +} + +struct commit_list *get_merge_bases_many_dirty(struct commit *one, + int n, + struct commit **twos) +{ + return get_merge_bases_many_0(one, n, twos, 0); +} + +struct commit_list *get_merge_bases(struct commit *one, struct commit *two) { - return get_merge_bases_many(one, 1, &two, cleanup); + return get_merge_bases_many_0(one, 1, &two, 1); } /* |