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

Re: Looking for help to understand external filter driver code

From
Lars Schneider <larsxschneider@gmail.com>
Date
Jul 19, 2016, 20:44 UTC
Message-ID
<7B44C694-7CB2-411D-9CC6-7334CCBAD20B@gmail.com>
In-Reply-To
<xmqqlh0xfoho.fsf@gitster.mtv.corp.google.com>
On 19 Jul 2016, at 20:53, Junio C Hamano <gitster@pobox.com> wrote:
Show 14 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
> 
>> The key benefit of this arrangement is the above can be done without
>> having to do poll() to flip between reading and writing that is
>> needed to avoid deadlocking, which kept the code simpler.  A later
>> conversion of the write side into async does not fundamentally
>> change anything from the original arrangement.
> 
> Translation: I was too lazy to worry about doing poll()/select()
> when I did it originally.  As long as you can do so correctly, be my
> guest to reduce one process by having the main process do both
> reading and writing.
> 
> ;-)

Thanks a lot for this explanation. My goal is to add an option to the clean/smudge filter config that instructs Git to keep the external filter process running. Whenever Git encounters a file to be filtered then it would continue to talk to the filter process over a simple pipe protocol:

Git writes --> 4 byte filename length Git writes --> filename string Git writes --> 4 byte content length Git writes --> content string Git reads <-- 4 byte filtered content length Git reads <-- filtered content

I still need to read more about poll()/select() but it looks to me as if these functions are only required if Git doesn't know what to expect. With the sketched protocol above that wouldn't be the case. Therefore, I wonder if I would need to use poll()/select()?

Thanks, Lars

Previous: Junio C HamanoNext: Junio C Hamano
Message 4 of 10 in “Looking for help to understand external filter driver code”
  1. Lars SchneiderJul 19, 2016
  2. Junio C HamanoJul 19, 2016
  3. Junio C HamanoJul 19, 2016
  4. Lars SchneiderJul 19, 2016
  5. Junio C HamanoJul 19, 2016
  6. Lars SchneiderJul 19, 2016
  7. Torsten BögershausenJul 20, 2016
  8. Jakub NarębskiJul 20, 2016
  9. Lars SchneiderJul 20, 2016
  10. Jeff KingJul 20, 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.