I'm trying it like this:
ZDOTDIR=/tmp/empty-home zsh /tmp/complete-bart 'git --'
Don't pass a single, quoted argument; quote each word separately if needed.
ZDOTDIR=/tmp/empty-home zsh /tmp/complete-bart git --
The symptom I experienced is that the command never ends,
apparently because the end marker never arrives.
I ran into this a couple of times myself. It seems to have something to do with the definition of "whole string":
If a PATTERN is given as well, output is read until the whole
string read matches the PATTERN, even in the non-blocking case.
If there's anything after the end marker, the "whole string" may not match. I had to try several different variations to find one that gave consistent results.