The filter-process interface learned to allow a process with long
latency give a "delayed" response.
* ls/filter-process-delayed:
convert: add "status=delayed" to filter process protocol
convert: refactor capabilities negotiation
convert: move multiple file filter error handling to separate function
convert: put the flags field before the flag itself for consistent style
t0021: write "OUT <size>" only on success
t0021: make debug log file name configurable
t0021: keep filter log files on comparison
Supported filter capabilities in version 2 are "clean" and
"smudge".
Supported filter capabilities in version 2 are "clean", "smudge",
and "delay".
Afterwards Git sends a list of "key=value" pairs terminated with
a flush packet. The list will contain at least the filter command
@ -512,12 +512,73 @@ the protocol then Git will stop the filter process and restart it
@@ -512,12 +512,73 @@ the protocol then Git will stop the filter process and restart it
with the next file that needs to be processed. Depending on the
`filter.<driver>.required` flag Git will interpret that as error.
After the filter has processed a blob it is expected to wait for
the next "key=value" list containing a command. Git will close
After the filter has processed a command it is expected to wait for
a "key=value" list containing the next command. Git will close
the command pipe on exit. The filter is expected to detect EOF
and exit gracefully on its own. Git will wait until the filter
process has stopped.
Delay
^^^^^
If the filter supports the "delay" capability, then Git can send the
flag "can-delay" after the filter command and pathname. This flag
denotes that the filter can delay filtering the current blob (e.g. to
compensate network latencies) by responding with no content but with
the status "delayed" and a flush packet.
------------------------
packet: git> command=smudge
packet: git> pathname=path/testfile.dat
packet: git> can-delay=1
packet: git> 0000
packet: git> CONTENT
packet: git> 0000
packet: git< status=delayed
packet: git< 0000
------------------------
If the filter supports the "delay" capability then it must support the
"list_available_blobs" command. If Git sends this command, then the
filter is expected to return a list of pathnames representing blobs
that have been delayed earlier and are now available.
The list must be terminated with a flush packet followed
by a "success" status that is also terminated with a flush packet. If
no blobs for the delayed paths are available, yet, then the filter is
expected to block the response until at least one blob becomes
available. The filter can tell Git that it has no more delayed blobs
by sending an empty list. As soon as the filter responds with an empty
list, Git stops asking. All blobs that Git has not received at this
point are considered missing and will result in an error.
------------------------
packet: git> command=list_available_blobs
packet: git> 0000
packet: git< pathname=path/testfile.dat
packet: git< pathname=path/otherfile.dat
packet: git< 0000
packet: git< status=success
packet: git< 0000
------------------------
After Git received the pathnames, it will request the corresponding
blobs again. These requests contain a pathname and an empty content
section. The filter is expected to respond with the smudged content
# Check that the contents of two files are equal and that their rot13 version
@ -342,7 +342,7 @@ test_expect_success 'diff does not reuse worktree files that need cleaning' '
@@ -342,7 +342,7 @@ test_expect_success 'diff does not reuse worktree files that need cleaning' '
'
test_expect_success PERL 'required process filter should filter data' '
@ -462,7 +462,7 @@ test_expect_success PERL 'required process filter should be used only for "clean
@@ -462,7 +462,7 @@ test_expect_success PERL 'required process filter should be used only for "clean
IN: clean test.r $S [OK] -- OUT: $S . [OK]
STOP
EOF
test_cmp_count expected.log rot13-filter.log &&
test_cmp_count expected.log debug.log &&
rm test.r &&
@ -474,12 +474,12 @@ test_expect_success PERL 'required process filter should be used only for "clean
@@ -474,12 +474,12 @@ test_expect_success PERL 'required process filter should be used only for "clean
@ -514,7 +514,7 @@ test_expect_success PERL 'required process filter should process multiple packet
@@ -514,7 +514,7 @@ test_expect_success PERL 'required process filter should process multiple packet
@ -529,7 +529,7 @@ test_expect_success PERL 'required process filter should process multiple packet
@@ -529,7 +529,7 @@ test_expect_success PERL 'required process filter should process multiple packet
@ -539,7 +539,7 @@ test_expect_success PERL 'required process filter should process multiple packet
@@ -539,7 +539,7 @@ test_expect_success PERL 'required process filter should process multiple packet
'
test_expect_success PERL 'required process filter with clean error should fail' '
@ -558,7 +558,7 @@ test_expect_success PERL 'required process filter with clean error should fail'
@@ -558,7 +558,7 @@ test_expect_success PERL 'required process filter with clean error should fail'
'
test_expect_success PERL 'process filter should restart after unexpected write failure' '
@ -579,7 +579,7 @@ test_expect_success PERL 'process filter should restart after unexpected write f
@@ -579,7 +579,7 @@ test_expect_success PERL 'process filter should restart after unexpected write f
@ -588,14 +588,14 @@ test_expect_success PERL 'process filter should restart after unexpected write f
@@ -588,14 +588,14 @@ test_expect_success PERL 'process filter should restart after unexpected write f
@ -609,7 +609,7 @@ test_expect_success PERL 'process filter should restart after unexpected write f
@@ -609,7 +609,7 @@ test_expect_success PERL 'process filter should restart after unexpected write f
'
test_expect_success PERL 'process filter should not be restarted if it signals an error' '
@ -634,12 +634,12 @@ test_expect_success PERL 'process filter should not be restarted if it signals a
@@ -634,12 +634,12 @@ test_expect_success PERL 'process filter should not be restarted if it signals a
@ -648,7 +648,7 @@ test_expect_success PERL 'process filter should not be restarted if it signals a
@@ -648,7 +648,7 @@ test_expect_success PERL 'process filter should not be restarted if it signals a
'
test_expect_success PERL 'process filter abort stops processing of all further files' '
@ -673,10 +673,10 @@ test_expect_success PERL 'process filter abort stops processing of all further f
@@ -673,10 +673,10 @@ test_expect_success PERL 'process filter abort stops processing of all further f
@ -701,4 +701,120 @@ test_expect_success PERL 'invalid process filter must fail (and not hang!)' '
@@ -701,4 +701,120 @@ test_expect_success PERL 'invalid process filter must fail (and not hang!)' '
)
'
test_expect_success PERL 'delayed checkout in process filter' '