t0021/rot13-filter: add capability functions
commitf11c8ce1f6fe85f11d6f6e4453fa81b6b6389b06
authorChristian Couder <christian.couder@gmail.com>
Sun, 5 Nov 2017 21:38:35 +0000 (5 22:38 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 7 Nov 2017 00:54:41 +0000 (7 09:54 +0900)
treef697ba86cfca132644cebdfbec2ce7c61496c0b3
parent4a9ef1bbc19f362a63c3e3ab88c651f97cbd1c1d
t0021/rot13-filter: add capability functions

These function help read and write capabilities.

To make them more generic and make it easy to reuse them,
the following changes are made:

- we don't require capabilities to come in a fixed order,
- we allow duplicates,
- we check that the remote supports the capabilities we
  advertise,
- we don't check if the remote declares any capability we
  don't know about.

The reason behind the last change is that the protocol
should work using only the capabilities that both ends
support, and it should not stop working if one end starts
to advertise a new capability.

Despite those changes, we can still require a set of
capabilities, and die if one of them is not supported.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t0021/rot13-filter.pl