Re: [PATCH v8 6/8] submodule: refactor show_submodule_summary with helper function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jacob Keller <jacob.e.keller@xxxxxxxxx> writes:

> @@ -290,12 +289,6 @@ static int prepare_submodule_summary(struct rev_info *rev, const char *path,
>  	add_pending_object(rev, &left->object, path);
>  	add_pending_object(rev, &right->object, path);
>  	merge_bases = get_merge_bases(left, right);
> -	if (merge_bases) {
> -		if (merge_bases->item == left)
> -			*fast_forward = 1;
> -		else if (merge_bases->item == right)
> -			*fast_backward = 1;
> -	}
>  	for (list = merge_bases; list; list = list->next) {
>  		list->item->object.flags |= UNINTERESTING;
>  		add_pending_object(rev, &list->item->object,

Not a new issue with this patch, but I wonder if this commit_list is
leaking here.

> +	/*
> +	 * Warn about missing commits in the submodule project, but only if
> +	 * they aren't null.
> +	 */
> +	if ((!is_null_oid(one) && !*left) ||
> +	     (!is_null_oid(two) && !*right))
> +		message = "(commits not present)";
> +
> +	merge_bases = get_merge_bases(*left, *right);
> +	if (merge_bases) {
> +		if (merge_bases->item == *left)
> +			fast_forward = 1;
> +		else if (merge_bases->item == *right)
> +			fast_backward = 1;
> +	}

And probably merge_bases also leaks here.

It is not cheap to compute merge bases, but show_submodule_summary()
makes two calls to get_merge_bases(), one in show_submodule_header()
and then another inside prepare_submodule_summary() to compute
exactly the same set of merge bases.  We somehow need to reduce it
to just one.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]