On 30 Aug 2016, at 20:59, Junio C Hamano <gits...@pobox.com> wrote:
>> "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.
Now, I see your point. How about "error-and-stop" or "error-stop"
instead of "error-all"?
>> 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?
Good argument. However, my intention here was to mimic the v1 filter
mechanism. If a filter fails then Git will run the same v1 filter on the
next file that needs to be filtered. If `filter.<driver>.required=false`
then a failure is even a legitimate result.
>> 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.
I am not sure I understand your last sentence. Just to be clear:
Would you prefer it, if Git would just close the pipe to the filter process
on Git exit and leave the filter running? I think I wouldn't even need
to close the pipe explicitly. The pipe would be closed automatically when
git exits or dies, right? The filter could detect EOF and exit on its own.
That would be OK with me.
>>>> +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.
I think `t/t0021/rot13-filter.pl` (part of this patch) serves this purpose