Lars Schneider <larsxschnei...@gmail.com> writes:
>> This part of the document is well-written to help filter-writers.
Don't thank me; thank yourself and reviewers of the previous rounds.
> The filter can exit right after the "error-all". If the filter does
> not exit then Git will kill the filter. I'll add this to the docs.
> "abort" could be ambiguous because it could be read as "abort only
> this file". "abort-all" would work, though. Would you prefer to see
> "error" replaced by "abort" and "error-all" by "abort-all"?
I was primarily reacting to "-all" part, so anything that ends with
"-all" is equally ugly from my point of view and not an improvement.
As I said, "error-all" as long as other reviewers are happy with is
OK by me, too.
> A filter that dies during communication or does not adhere to the protocol
> is a faulty filter. Feeding the faulty filter after restart with the same
> blob would likely cause the same error.
Why does Git restart it and continue with the rest of the blobs
then? Is there a reason to believe it may produce correct results
for other blobs if you run it again?
> B) If we communicate "shutdown" to the filter then we need to give the
> filter some time to perform the exit before the filter is killed on
> Git exit. I wasn't able to come up with a good answer how long Git
> should wait for the exit.
Would that be an issue? A filter is buggy if told to shutdown,
ignores the request and hangs around forever. I do not think we
even need to kill it. It is not Git's problem.
I personally would be reluctant to become a filter process writer if
the system it will be talking to can kill it without giving it a
chance to do a graceful exit, but perhaps that is just me. I don't
know if closing the pipe going there where you are having Git to
kill the process on the other end is any more involved than what you
have without extra patches.
>>> +Please note that you cannot use an existing `filter.<driver>.clean`
>>> +or `filter.<driver>.smudge` command with `filter.<driver>.process`
>>> +because the former two use a different inter process communication
>>> +protocol than the latter one.
>> Would it be a useful sample program we can ship in contrib/ if you
>> created a "filter adapter" that reads these two configuration
>> variables and act as a filter.<driver>.process?
> You mean a v2 filter that would use v1 filters under the hood?
> If we would drop v1, then this would be useful. Otherwise I don't
> see any need for such a thing.
I meant it as primarily an example people can learn from when they
want to write their own.