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

2016-08-19 Thread Jacob Keller
On Fri, Aug 19, 2016 at 1:24 PM, Junio C Hamano  wrote:
> 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.
>

I can make show_submodule_headers take another parameter which we
pass, and then pass that into prepare_submodule_summary...?

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


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

2016-08-19 Thread Junio C Hamano
Jacob Keller  writes:

> @@ -290,12 +289,6 @@ static int prepare_submodule_summary(struct rev_info 
> *rev, const char *path,
>   add_pending_object(rev, >object, path);
>   add_pending_object(rev, >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, >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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html