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>
This commit is contained in:
@ -1330,7 +1330,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
|
||||
if (!remoteheads)
|
||||
; /* already up-to-date */
|
||||
else if (!remoteheads->next)
|
||||
common = get_merge_bases(head_commit, remoteheads->item, 1);
|
||||
common = get_merge_bases(head_commit, remoteheads->item);
|
||||
else {
|
||||
struct commit_list *list = remoteheads;
|
||||
commit_list_insert(head_commit, &list);
|
||||
@ -1427,7 +1427,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
|
||||
* merge_bases again, otherwise "git merge HEAD^
|
||||
* HEAD^^" would be missed.
|
||||
*/
|
||||
common_one = get_merge_bases(head_commit, j->item, 1);
|
||||
common_one = get_merge_bases(head_commit, j->item);
|
||||
if (hashcmp(common_one->item->object.sha1,
|
||||
j->item->object.sha1)) {
|
||||
up_to_date = 0;
|
||||
|
||||
Reference in New Issue
Block a user