diff options
author | Christian Couder <christian.couder@gmail.com> | 2017-11-05 22:38:33 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-11-07 09:54:41 +0900 |
commit | 25cbfe34656d4cf25e1bf16ac61f981cb3d5c1b3 (patch) | |
tree | fdbb93828c003ba7c5e24d1dc94a0b2371f89207 /t | |
parent | t0021/rot13-filter: improve error message (diff) | |
download | tgif-25cbfe34656d4cf25e1bf16ac61f981cb3d5c1b3.tar.xz |
t0021/rot13-filter: add packet_initialize()
Let's refactor the code to initialize communication into its own
packet_initialize() function, so that we can reuse this
functionality in following patches.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rw-r--r-- | t/t0021/rot13-filter.pl | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/t/t0021/rot13-filter.pl b/t/t0021/rot13-filter.pl index f31ff595fe..2f74ab2e45 100644 --- a/t/t0021/rot13-filter.pl +++ b/t/t0021/rot13-filter.pl @@ -127,19 +127,25 @@ sub packet_flush { STDOUT->flush(); } +sub packet_initialize { + my ($name, $version) = @_; + + packet_compare_lists([0, $name . "-client"], packet_txt_read()) || + die "bad initialize"; + packet_compare_lists([0, "version=" . $version], packet_txt_read()) || + die "bad version"; + packet_compare_lists([1, ""], packet_bin_read()) || + die "bad version end"; + + packet_txt_write( $name . "-server" ); + packet_txt_write( "version=" . $version ); + packet_flush(); +} + print $debug "START\n"; $debug->flush(); -packet_compare_lists([0, "git-filter-client"], packet_txt_read()) || - die "bad initialize"; -packet_compare_lists([0, "version=2"], packet_txt_read()) || - die "bad version"; -packet_compare_lists([1, ""], packet_bin_read()) || - die "bad version end"; - -packet_txt_write("git-filter-server"); -packet_txt_write("version=2"); -packet_flush(); +packet_initialize("git-filter", 2); packet_compare_lists([0, "capability=clean"], packet_txt_read()) || die "bad capability"; |