> On 12 Aug 2016, at 18:48, Stefan Beller <sbel...@google.com> wrote:
> On Fri, Aug 12, 2016 at 9:38 AM, Jeff King <p...@peff.net> wrote:
>> On Fri, Aug 12, 2016 at 09:33:18AM -0700, Stefan Beller wrote:
>>>> If the result content is empty then the filter is expected to respond
>>>> with a success status and an empty list.
>>>> ------------------------
>>>> packet:          git< status=success\n
>>>> packet:          git< 0000
>>>> packet:          git< 0000  # empty content!
>>>> packet:          git< 0000  # empty list!
>>>> ------------------------
>>> Why do we need the last flush packet? We'd expect as many successes
>>> as we send out contents? Do we plan on interleaving operation, i.e.
>>> Git sends out 10 files but the filter process is not as fast as Git sending
>>> out and the answers trickle in slowly?
>> There was prior discussion in the thread, but basically, it is there to
>> be able to signal an error that is encountered midway through sending
>> the file (i.e., to say "status=error"). If you do not have a final
>> flush, then you would send nothing, and the receiver would be left
>> wondering if you were successful, or if it simply did not get your error
>> report yet.
>    I did not follow the prior discussion, so I approached this review with
>    no prior knowledge from prior reviews, but instead read through and
>    was asking a lot of questions that came up immediately. In case my
>    questions are too dumb just omit them, but I thought they were good
>    material to answer in a commit message ("Why did we do it this way
>    and not differently").

Thanks! That's very helpful and I will address your questions in the commit
message as anyone looking at this commit in the future will have no prior 
knowledge, too.

> Thanks for the explanation. So this is similar as the situation below
> that we wait for the flush and then an error/success report?

Correct. If we would just process the status packet then we wouldn't
even need to wait for the flush. I added flush because that allows us
to send an arbitrary list of key=value pairs in the future.

>>>> If the filter experiences an error during processing, then it can
>>>> send the status "error". Depending on the `filter.<driver>.required`
>>>> flag Git will interpret that as error but it will not stop or restart
>>>> the filter process.
>>>> ------------------------
>>>> packet:          git< status=success\n
>>> So the first success is meaningless essentially?
>>> Would it make sense to move the sucess behind the content sending
>>> in all cases?
>> No, the first success says "good so far, here's the file content". The
>> second says "I succeeded in sending you the file content".
>> You _can_ drop the first one, but it may be more convenient for the
>> receiver to know up-front that there was a failure.
> If there was a failure upfront, it would become
> packet:          git< 0000
> # no content is encapsulated here
> packet:          git< 0000
> packet:          git< status=error\n
> packet:          git< 0000

No, a failure upfront would look like this (see documentation):

packet:          git< status=error\n
packet:          git< 0000

No content and no 2nd key=value pair list is exchanged after an error.

> so from a protocol side I'd claim it doesn't look bad.
> I assume with convenient you mean the implementation
> side of things?
> If we do the success first and then error out halfway, we
> still have to clean up, so I do not see how this impacts
> implementation?

That is true. The reasoning is that an error in between is somewhat
less expected. Therefore additional work is OK.

An error upfront is much more likely because it is also a mechanism
for the filter to reject certain files. If the filter is configured
as "required=false" then this reject would actually be OK.

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

Reply via email to