Re: [PATCH v5 16/16] merge-recursive: flush output buffer even when erroring out
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 27, 2016, 22:20 UTC
- Message-ID
- <xmqq4m7avi32.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <af195979d2c0cf9958b7811b4d2294deeea30b75.1469547160.git.johannes.schindelin@gmx.de>
Johannes Schindelin <johannes.schindelin@gmx.de> writes:
Show 11 quoted lines
> diff --git a/merge-recursive.c b/merge-recursive.c > index a16b150..66e93e0 100644 > --- a/merge-recursive.c > +++ b/merge-recursive.c > @@ -2069,6 +2069,7 @@ int merge_recursive(struct merge_options *o, > o->ancestor = "merged common ancestors"; > clean = merge_trees(o, h1->tree, h2->tree, merged_common_ancestors->tree, > &mrtree); > + flush_output(o); > if (clean < 0) > return clean;
This is of course a good change, but we need to assume that no further output is made from the remainder of the function for the change in the next hunk to remove the existing flush to be correct.
And once we assume that, then the "we no longer need this buffer, so release it" added in 15/16 can also move here, right?
I am wondering if there is a low-impact way to make sure that assumption will not be broken.
Show 8 quoted lines
> @@ -2077,7 +2078,6 @@ int merge_recursive(struct merge_options *o, > commit_list_insert(h1, &(*result)->parents); > commit_list_insert(h2, &(*result)->parents->next); > } > - flush_output(o); > if (o->buffer_output < 2) > strbuf_release(&o->obuf); > if (show(o, 2))