Re: [PATCH v5 15/16] Ensure that the output buffer is released after calling merge_trees()

2 messages, 2 authors, 2016-08-01 · open the first message on its own page

Re: [PATCH v5 15/16] Ensure that the output buffer is released after calling merge_trees()

From: Junio C Hamano <hidden>
Date: 2016-07-27 22:16:11

Johannes Schindelin [off-list ref] writes:
quoted hunk
diff --git a/merge-recursive.c b/merge-recursive.c
index 311cfa4..a16b150 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -2078,6 +2078,8 @@ int merge_recursive(struct merge_options *o,
 		commit_list_insert(h2, &(*result)->parents->next);
 	}
 	flush_output(o);
+	if (o->buffer_output < 2)
+		strbuf_release(&o->obuf);
 	if (show(o, 2))
 		diff_warn_rename_limit("merge.renamelimit",
 				       o->needed_rename_limit, 0);
Other two hunks looked good, but this one I am not sure what is
going on.  It this were "if call-depth says we are called by another
merge_recursive, do not discard the buffer", I would understand, but
why does this have to be tied to o->buffer_output being "we buffer
the output but not errors"?

Re: [PATCH v5 15/16] Ensure that the output buffer is released after calling merge_trees()

From: Johannes Schindelin <hidden>
Date: 2016-08-01 09:42:29

Hi Junio,

On Wed, 27 Jul 2016, Junio C Hamano wrote:
Johannes Schindelin [off-list ref] writes:
quoted
diff --git a/merge-recursive.c b/merge-recursive.c
index 311cfa4..a16b150 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -2078,6 +2078,8 @@ int merge_recursive(struct merge_options *o,
 		commit_list_insert(h2, &(*result)->parents->next);
 	}
 	flush_output(o);
+	if (o->buffer_output < 2)
+		strbuf_release(&o->obuf);
 	if (show(o, 2))
 		diff_warn_rename_limit("merge.renamelimit",
 				       o->needed_rename_limit, 0);
Other two hunks looked good, but this one I am not sure what is
going on.  It this were "if call-depth says we are called by another
merge_recursive, do not discard the buffer", I would understand, but
why does this have to be tied to o->buffer_output being "we buffer
the output but not errors"?
Good point. I changed it to test for !o->call_depth in addition.

We must not release the output buffer here if buffer_output >= 2: the
level "2" of the buffer_output field says that the caller of the recursive
merge expects the output to remain in the buffer until after
`merge_recursive()` returns.

Ciao,
Dscho
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help