From: Lars Schneider <larsxschneider@gmail.com>
To: "Jakub Narębski" <jnareb@gmail.com>, "Jeff King" <peff@peff.net>
Cc: git <git@vger.kernel.org>, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH v10 13/14] convert: add filter.<driver>.process option
Date: Sat, 15 Oct 2016 07:45:48 -0700 [thread overview]
Message-ID: <3732E902-2FE9-4C99-B27D-69B9A3FF8639@gmail.com> (raw)
In-Reply-To: <37c12539-3edd-e04b-6e09-e977a854661c@gmail.com>
@Peff: If you have time, it would be great if you could comment on
one question below prefixed with "@Peff". Thanks!
> On 12 Oct 2016, at 03:54, Jakub Narębski <jnareb@gmail.com> wrote:
>
> W dniu 12.10.2016 o 00:26, Lars Schneider pisze:
>>> On 09 Oct 2016, at 01:06, Jakub Narębski <jnareb@gmail.com> wrote:
>>>>
>>
>>>> After the filter started
>>>> Git sends a welcome message ("git-filter-client"), a list of
>>>> supported protocol version numbers, and a flush packet. Git expects
>>>> +to read a welcome response message ("git-filter-server") and exactly
>>>> +one protocol version number from the previously sent list. All further
>>>> +communication will be based on the selected version. The remaining
>>>> +protocol description below documents "version=2". Please note that
>>>> +"version=42" in the example below does not exist and is only there
>>>> +to illustrate how the protocol would look like with more than one
>>>> +version.
>>>> +
>>>> +After the version negotiation Git sends a list of all capabilities that
>>>> +it supports and a flush packet. Git expects to read a list of desired
>>>> +capabilities, which must be a subset of the supported capabilities list,
>>>> +and a flush packet as response:
>>>> +------------------------
>>>> +packet: git> git-filter-client
>>>> +packet: git> version=2
>>>> +packet: git> version=42
>>>> +packet: git> 0000
>>>> +packet: git< git-filter-server
>>>> +packet: git< version=2
>>>> +packet: git> clean=true
>>>> +packet: git> smudge=true
>>>> +packet: git> not-yet-invented=true
>>>> +packet: git> 0000
>>>> +packet: git< clean=true
>>>> +packet: git< smudge=true
>>>> +packet: git< 0000
>>>
>>> WARNING: This example is different from description!!!
>>
>> Can you try to explain the difference more clearly? I read it multiple
>> times and I think this is sound.
>
> I'm sorry it was *my mistake*. I have read the example exchange wrong.
>
> On the other hand that means that I have other comment, which I though
> was addressed already in v10, namely that not all exchanges ends with
> flush packet (inconsistency, and I think a bit of lack of extendability).
Well, this part of the protocol is not supposed to be extensible because
it is supposed to deal *only* with the version number. It needs to keep
the same structure to ensure forward and backward compatibility.
However, for consistency sake I will add a flush packet.
>>> In description above the example you have 4-part handshake, not 3-part;
>>> the filter is described to send list of supported capabilities last
>>> (a subset of what Git command supports).
>>
>> Part 1: Git sends a welcome message...
>> Part 2: Git expects to read a welcome response message...
>> Part 3: After the version negotiation Git sends a list of all capabilities...
>> Part 4: Git expects to read a list of desired capabilities...
>>
>> I think example and text match, no?
>
> Yes, it does; as I have said already, I have misread the example.
>
> Anyway, in some cases 4-way handshake, where Git sends list of
> supported capabilities first, is better. If the protocol has
> to prepare something for each of capabilities, and perhaps check
> those preparation status, it can do it after Git sends what it
> could need, and before it sends what it does support.
>
> Though it looks a bit strange that client (as Git is client here)
> sends its capabilities first...
Git tells the filter what it can do. Then the filter decides what
features it supports. I would prefer to keep it that way as I don't
see a strong advantage for the other way around.
>>> By the way, now I look at it, the argument for using the
>>> "<capability>=true" format instead of "capability=<capability>"
>>> (or "supported-command=<capability>") is weak. The argument for
>>> using "<variable>=<value>" to make it easier to implement parsing
>>> is sound, but the argument for "<capability>=true" is weak.
>>>
>>> The argument was that with "<capability>=true" one can simply
>>> parse metadata into hash / dictionary / hashmap, and choose
>>> response based on that. Hash / hashmap / associative array
>>> needs different keys, so the reasoning went for "<capability>=true"
>>> over "capability=<capability>"... but the filter process still
>>> needs to handle lines with repeating keys, namely "version=<N>"
>>> lines!
>>>
>>> So the argument doesn't hold water IMVHO, and we can choose
>>> version which reads better / is more natural.
>>
>> I have to agree that "capability=<capability>" might read a
>> little bit nicer. However, Peff suggested "<capability>=true"
>> as his preference and this is absolutely OK with me.
>
> From what I remember it was Peff stating that he thinks "<foo>=true"
> is easier for parsing (it is, but we still need to support the harder
> way parsing anyway), and offered that "<foo>" is good enough (if less
> consistent).
>
>> I am happy to change that if a second reviewer shares your
>> opinion.
>
> Also, with "capability=<foo>" we can be more self descriptive,
> for example "supported-command=<foo>"; though "capability" is good
> enough for me.
>
> For example
>
> packet: git> wants=clean
> packet: git> wants=smudge
> packet: git> wants=size
> packet: git> 0000
> packet: git< supports=clean
> packet: git< supports=smudge
> packet: git< 0000
>
> Though coming up with good names is hard; and as I said "capability"
> is good enough; OTOH with "smudge=true" etc. we don't need to come
> up with good name at all... though I wonder if it is a good thing `\_o,_/
How about this (I borrowed these terms from contract negotiation)?
packet: git> offers=clean
packet: git> offers=smudge
packet: git> offers=size
packet: git> 0000
packet: git< accepts=clean
packet: git< accepts=smudge
packet: git< 0000
@Peff: Would that be OK for you?
>>>> +------------------------
>>>> +packet: git< status=abort
>>>> +packet: git< 0000
>>>> +------------------------
>>>> +
>>>> +After the filter has processed a blob it is expected to wait for
>>>> +the next "key=value" list containing a command. Git will close
>>>> +the command pipe on exit. The filter is expected to detect EOF
>>>> +and exit gracefully on its own.
>>>
>>> Any "kill filter" solutions should probably be put here.
>>
>> Agreed.
>>
>>> I guess
>>> that filter exiting means EOF on its standard output when read
>>> by Git command, isn't it?
>>
>> Yes, but at this point Git is not listening anymore.
>
> I think it might be good idea to have here the information about
> what filter process should do if it needs maybe lengthy closing
> process, to not hold/stop Git command or to not be killed.
I've added:
"Git will wait until the filter process has stopped."
Thanks,
Lars
next prev parent reply other threads:[~2016-10-15 14:45 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-08 11:25 [PATCH v10 00/14] Git filter protocol larsxschneider
2016-10-08 11:25 ` [PATCH v10 01/14] convert: quote filter names in error messages larsxschneider
2016-10-08 11:25 ` [PATCH v10 02/14] convert: modernize tests larsxschneider
2016-10-08 11:25 ` [PATCH v10 03/14] run-command: move check_pipe() from write_or_die to run_command larsxschneider
2016-10-08 11:25 ` [PATCH v10 04/14] run-command: add clean_on_exit_handler larsxschneider
2016-10-11 12:12 ` Johannes Schindelin
2016-10-15 15:02 ` Lars Schneider
2016-10-16 8:03 ` Johannes Schindelin
2016-10-16 21:57 ` Lars Schneider
2016-10-08 11:25 ` [PATCH v10 05/14] pkt-line: rename packet_write() to packet_write_fmt() larsxschneider
2016-10-08 11:25 ` [PATCH v10 06/14] pkt-line: extract set_packet_header() larsxschneider
2016-10-08 11:25 ` [PATCH v10 07/14] pkt-line: add packet_write_fmt_gently() larsxschneider
2016-10-08 11:25 ` [PATCH v10 08/14] pkt-line: add packet_flush_gently() larsxschneider
2016-10-08 11:25 ` [PATCH v10 09/14] pkt-line: add packet_write_gently() larsxschneider
2016-10-08 11:25 ` [PATCH v10 10/14] pkt-line: add functions to read/write flush terminated packet streams larsxschneider
2016-10-08 11:25 ` [PATCH v10 11/14] convert: make apply_filter() adhere to standard Git error handling larsxschneider
2016-10-08 11:25 ` [PATCH v10 12/14] convert: prepare filter.<driver>.process option larsxschneider
2016-10-08 11:25 ` [PATCH v10 13/14] convert: add " larsxschneider
2016-10-08 23:06 ` Jakub Narębski
2016-10-09 5:32 ` Torsten Bögershausen
2016-10-11 15:29 ` Lars Schneider
2016-10-11 22:26 ` Lars Schneider
2016-10-12 10:54 ` Jakub Narębski
2016-10-15 14:45 ` Lars Schneider [this message]
2016-10-15 17:41 ` Jeff King
2016-10-15 19:42 ` Jakub Narębski
2016-10-10 19:58 ` Junio C Hamano
2016-10-11 8:11 ` Lars Schneider
2016-10-11 10:09 ` Torsten Bögershausen
2016-10-16 23:13 ` Lars Schneider
2016-10-17 17:05 ` Junio C Hamano
2016-10-08 11:25 ` [PATCH v10 14/14] contrib/long-running-filter: add long running filter example larsxschneider
2016-10-09 5:42 ` Torsten Bögershausen
2016-10-15 14:47 ` Lars Schneider
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3732E902-2FE9-4C99-B27D-69B9A3FF8639@gmail.com \
--to=larsxschneider@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jnareb@gmail.com \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).