git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v5 14/15] convert: add filter.<driver>.process option

From
Stefan Beller <sbeller@google.com>
Date
Aug 12, 2016, 16:48 UTC
Message-ID
<CAGZ79kaRKROUganF838w29rCkJ592sZvu+q9fo+h4a4sPeDXMQ@mail.gmail.com>
In-Reply-To
<20160812163809.3wdkuqegxfjam2yn@sigill.intra.peff.net>
On Fri, Aug 12, 2016 at 9:38 AM, Jeff King <peff@peff.net> wrote:
Show 22 quoted lines
> 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 for the explanation. So this is similar as the situation below that we wait for the flush and then an error/success report?

Show 17 quoted lines
>
>> > 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

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?

Thanks, Stefan

Previous: Jeff KingNext: Lars Schneider
Message 5 of 50 in “Git filter protocol”
  1. 00/15 Git filter protocollarsxschneider@gmail.com, Aug 10, 2016
  2. 14/15 convert: add filter.<driver>.process optionlarsxschneider@gmail.com, Aug 10, 2016
  3. Stefan BellerAug 12, 2016
  4. Jeff KingAug 12, 2016
  5. Stefan BellerAug 12, 2016
  6. Lars SchneiderAug 12, 2016
  7. Junio C HamanoAug 12, 2016
  8. Lars SchneiderAug 12, 2016
  9. Junio C HamanoAug 12, 2016
  10. Lars SchneiderAug 12, 2016
  11. Stefan BellerAug 12, 2016
  12. Lars SchneiderAug 12, 2016
  13. 08/15 pkt-line: rename packet_write() to packet_write_fmt()larsxschneider@gmail.com, Aug 10, 2016
  14. 05/15 pkt-line: add packet_write_gently_fmt()larsxschneider@gmail.com, Aug 10, 2016
  15. Jeff KingAug 10, 2016
  16. Junio C HamanoAug 10, 2016
  17. Lars SchneiderAug 10, 2016
  18. Junio C HamanoAug 10, 2016
  19. Lars SchneiderAug 10, 2016
  20. Jeff KingAug 10, 2016
  21. 15/15 read-cache: make sure file handles are not inherited by child processeslarsxschneider@gmail.com, Aug 10, 2016
  22. Johannes SchindelinAug 18, 2016
  23. 01/15 pkt-line: extract set_packet_header()larsxschneider@gmail.com, Aug 10, 2016
  24. 09/15 pack-protocol: fix maximum pkt-line sizelarsxschneider@gmail.com, Aug 10, 2016
  25. 06/15 pkt-line: add packet_flush_gently()larsxschneider@gmail.com, Aug 10, 2016
  26. 10/15 convert: quote filter names in error messageslarsxschneider@gmail.com, Aug 10, 2016
  27. 07/15 pkt-line: add functions to read/write flush terminated packet streamslarsxschneider@gmail.com, Aug 10, 2016
  28. 12/15 convert: generate large test files only oncelarsxschneider@gmail.com, Aug 10, 2016
  29. 11/15 convert: modernize testslarsxschneider@gmail.com, Aug 10, 2016
  30. 04/15 pkt-line: add packet_write_gently()larsxschneider@gmail.com, Aug 10, 2016
  31. Jeff KingAug 10, 2016
  32. Lars SchneiderAug 10, 2016
  33. Jeff KingAug 10, 2016
  34. Junio C HamanoAug 10, 2016
  35. Lars SchneiderAug 10, 2016
  36. Junio C HamanoAug 10, 2016
  37. Lars SchneiderAug 10, 2016
  38. 02/15 pkt-line: call packet_trace() only if a packet is actually sendlarsxschneider@gmail.com, Aug 10, 2016
  39. Jeff KingAug 10, 2016
  40. Lars SchneiderAug 10, 2016
  41. Jeff KingAug 10, 2016
  42. Lars SchneiderAug 10, 2016
  43. Jeff KingAug 10, 2016
  44. 13/15 convert: make apply_filter() adhere to standard Git error handlinglarsxschneider@gmail.com, Aug 10, 2016
  45. 03/15 pkt-line: add `gentle` parameter to format_packet()larsxschneider@gmail.com, Aug 10, 2016
  46. Jeff KingAug 10, 2016
  47. Lars SchneiderAug 10, 2016
  48. Jeff KingAug 10, 2016
  49. Lars SchneiderAug 10, 2016
  50. Jeff KingAug 10, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.