Merge branch 'ls/filter-process'
Doc update. * ls/filter-process: t0021: fix flaky test docs: warn about possible '=' in clean/smudge filter process values
This commit is contained in:
commit
08721a056b
@ -435,7 +435,9 @@ to filter relative to the repository root. Right after the flush packet
|
|||||||
Git sends the content split in zero or more pkt-line packets and a
|
Git sends the content split in zero or more pkt-line packets and a
|
||||||
flush packet to terminate content. Please note, that the filter
|
flush packet to terminate content. Please note, that the filter
|
||||||
must not send any response before it received the content and the
|
must not send any response before it received the content and the
|
||||||
final flush packet.
|
final flush packet. Also note that the "value" of a "key=value" pair
|
||||||
|
can contain the "=" character whereas the key would never contain
|
||||||
|
that character.
|
||||||
------------------------
|
------------------------
|
||||||
packet: git> command=smudge
|
packet: git> command=smudge
|
||||||
packet: git> pathname=path/testfile.dat
|
packet: git> pathname=path/testfile.dat
|
||||||
|
@ -81,8 +81,12 @@ packet_txt_write("capability=smudge");
|
|||||||
packet_flush();
|
packet_flush();
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
my ($command) = packet_txt_read() =~ /^command=([^=]+)$/;
|
my ($command) = packet_txt_read() =~ /^command=(.+)$/;
|
||||||
my ($pathname) = packet_txt_read() =~ /^pathname=([^=]+)$/;
|
my ($pathname) = packet_txt_read() =~ /^pathname=(.+)$/;
|
||||||
|
|
||||||
|
if ( $pathname eq "" ) {
|
||||||
|
die "bad pathname '$pathname'";
|
||||||
|
}
|
||||||
|
|
||||||
packet_bin_read();
|
packet_bin_read();
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ test_expect_success setup '
|
|||||||
git checkout -- test test.t test.i &&
|
git checkout -- test test.t test.i &&
|
||||||
|
|
||||||
echo "content-test2" >test2.o &&
|
echo "content-test2" >test2.o &&
|
||||||
echo "content-test3 - filename with special characters" >"test3 '\''sq'\'',\$x.o"
|
echo "content-test3 - filename with special characters" >"test3 '\''sq'\'',\$x=.o"
|
||||||
'
|
'
|
||||||
|
|
||||||
script='s/^\$Id: \([0-9a-f]*\) \$/\1/p'
|
script='s/^\$Id: \([0-9a-f]*\) \$/\1/p'
|
||||||
@ -358,12 +358,12 @@ test_expect_success PERL 'required process filter should filter data' '
|
|||||||
cp "$TEST_ROOT/test.o" test.r &&
|
cp "$TEST_ROOT/test.o" test.r &&
|
||||||
cp "$TEST_ROOT/test2.o" test2.r &&
|
cp "$TEST_ROOT/test2.o" test2.r &&
|
||||||
mkdir testsubdir &&
|
mkdir testsubdir &&
|
||||||
cp "$TEST_ROOT/test3 '\''sq'\'',\$x.o" "testsubdir/test3 '\''sq'\'',\$x.r" &&
|
cp "$TEST_ROOT/test3 '\''sq'\'',\$x=.o" "testsubdir/test3 '\''sq'\'',\$x=.r" &&
|
||||||
>test4-empty.r &&
|
>test4-empty.r &&
|
||||||
|
|
||||||
S=$(file_size test.r) &&
|
S=$(file_size test.r) &&
|
||||||
S2=$(file_size test2.r) &&
|
S2=$(file_size test2.r) &&
|
||||||
S3=$(file_size "testsubdir/test3 '\''sq'\'',\$x.r") &&
|
S3=$(file_size "testsubdir/test3 '\''sq'\'',\$x=.r") &&
|
||||||
|
|
||||||
filter_git add . &&
|
filter_git add . &&
|
||||||
cat >expected.log <<-EOF &&
|
cat >expected.log <<-EOF &&
|
||||||
@ -372,35 +372,20 @@ test_expect_success PERL 'required process filter should filter data' '
|
|||||||
IN: clean test.r $S [OK] -- OUT: $S . [OK]
|
IN: clean test.r $S [OK] -- OUT: $S . [OK]
|
||||||
IN: clean test2.r $S2 [OK] -- OUT: $S2 . [OK]
|
IN: clean test2.r $S2 [OK] -- OUT: $S2 . [OK]
|
||||||
IN: clean test4-empty.r 0 [OK] -- OUT: 0 [OK]
|
IN: clean test4-empty.r 0 [OK] -- OUT: 0 [OK]
|
||||||
IN: clean testsubdir/test3 '\''sq'\'',\$x.r $S3 [OK] -- OUT: $S3 . [OK]
|
IN: clean testsubdir/test3 '\''sq'\'',\$x=.r $S3 [OK] -- OUT: $S3 . [OK]
|
||||||
STOP
|
STOP
|
||||||
EOF
|
EOF
|
||||||
test_cmp_count expected.log rot13-filter.log &&
|
test_cmp_count expected.log rot13-filter.log &&
|
||||||
|
|
||||||
filter_git commit -m "test commit 2" &&
|
git commit -m "test commit 2" &&
|
||||||
cat >expected.log <<-EOF &&
|
rm -f test2.r "testsubdir/test3 '\''sq'\'',\$x=.r" &&
|
||||||
START
|
|
||||||
init handshake complete
|
|
||||||
IN: clean test.r $S [OK] -- OUT: $S . [OK]
|
|
||||||
IN: clean test2.r $S2 [OK] -- OUT: $S2 . [OK]
|
|
||||||
IN: clean test4-empty.r 0 [OK] -- OUT: 0 [OK]
|
|
||||||
IN: clean testsubdir/test3 '\''sq'\'',\$x.r $S3 [OK] -- OUT: $S3 . [OK]
|
|
||||||
IN: clean test.r $S [OK] -- OUT: $S . [OK]
|
|
||||||
IN: clean test2.r $S2 [OK] -- OUT: $S2 . [OK]
|
|
||||||
IN: clean test4-empty.r 0 [OK] -- OUT: 0 [OK]
|
|
||||||
IN: clean testsubdir/test3 '\''sq'\'',\$x.r $S3 [OK] -- OUT: $S3 . [OK]
|
|
||||||
STOP
|
|
||||||
EOF
|
|
||||||
test_cmp_count expected.log rot13-filter.log &&
|
|
||||||
|
|
||||||
rm -f test2.r "testsubdir/test3 '\''sq'\'',\$x.r" &&
|
|
||||||
|
|
||||||
filter_git checkout --quiet --no-progress . &&
|
filter_git checkout --quiet --no-progress . &&
|
||||||
cat >expected.log <<-EOF &&
|
cat >expected.log <<-EOF &&
|
||||||
START
|
START
|
||||||
init handshake complete
|
init handshake complete
|
||||||
IN: smudge test2.r $S2 [OK] -- OUT: $S2 . [OK]
|
IN: smudge test2.r $S2 [OK] -- OUT: $S2 . [OK]
|
||||||
IN: smudge testsubdir/test3 '\''sq'\'',\$x.r $S3 [OK] -- OUT: $S3 . [OK]
|
IN: smudge testsubdir/test3 '\''sq'\'',\$x=.r $S3 [OK] -- OUT: $S3 . [OK]
|
||||||
STOP
|
STOP
|
||||||
EOF
|
EOF
|
||||||
test_cmp_exclude_clean expected.log rot13-filter.log &&
|
test_cmp_exclude_clean expected.log rot13-filter.log &&
|
||||||
@ -421,14 +406,14 @@ test_expect_success PERL 'required process filter should filter data' '
|
|||||||
IN: smudge test.r $S [OK] -- OUT: $S . [OK]
|
IN: smudge test.r $S [OK] -- OUT: $S . [OK]
|
||||||
IN: smudge test2.r $S2 [OK] -- OUT: $S2 . [OK]
|
IN: smudge test2.r $S2 [OK] -- OUT: $S2 . [OK]
|
||||||
IN: smudge test4-empty.r 0 [OK] -- OUT: 0 [OK]
|
IN: smudge test4-empty.r 0 [OK] -- OUT: 0 [OK]
|
||||||
IN: smudge testsubdir/test3 '\''sq'\'',\$x.r $S3 [OK] -- OUT: $S3 . [OK]
|
IN: smudge testsubdir/test3 '\''sq'\'',\$x=.r $S3 [OK] -- OUT: $S3 . [OK]
|
||||||
STOP
|
STOP
|
||||||
EOF
|
EOF
|
||||||
test_cmp_exclude_clean expected.log rot13-filter.log &&
|
test_cmp_exclude_clean expected.log rot13-filter.log &&
|
||||||
|
|
||||||
test_cmp_committed_rot13 "$TEST_ROOT/test.o" test.r &&
|
test_cmp_committed_rot13 "$TEST_ROOT/test.o" test.r &&
|
||||||
test_cmp_committed_rot13 "$TEST_ROOT/test2.o" test2.r &&
|
test_cmp_committed_rot13 "$TEST_ROOT/test2.o" test2.r &&
|
||||||
test_cmp_committed_rot13 "$TEST_ROOT/test3 '\''sq'\'',\$x.o" "testsubdir/test3 '\''sq'\'',\$x.r"
|
test_cmp_committed_rot13 "$TEST_ROOT/test3 '\''sq'\'',\$x=.o" "testsubdir/test3 '\''sq'\'',\$x=.r"
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
|
@ -109,14 +109,18 @@ print $debug "init handshake complete\n";
|
|||||||
$debug->flush();
|
$debug->flush();
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
my ($command) = packet_txt_read() =~ /^command=([^=]+)$/;
|
my ($command) = packet_txt_read() =~ /^command=(.+)$/;
|
||||||
print $debug "IN: $command";
|
print $debug "IN: $command";
|
||||||
$debug->flush();
|
$debug->flush();
|
||||||
|
|
||||||
my ($pathname) = packet_txt_read() =~ /^pathname=([^=]+)$/;
|
my ($pathname) = packet_txt_read() =~ /^pathname=(.+)$/;
|
||||||
print $debug " $pathname";
|
print $debug " $pathname";
|
||||||
$debug->flush();
|
$debug->flush();
|
||||||
|
|
||||||
|
if ( $pathname eq "" ) {
|
||||||
|
die "bad pathname '$pathname'";
|
||||||
|
}
|
||||||
|
|
||||||
# Flush
|
# Flush
|
||||||
packet_bin_read();
|
packet_bin_read();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user