2 fn capabilities(input
: &str) -> gix_transport
::client
::Capabilities
{
3 gix_transport
::client
::Capabilities
::from_bytes(format
!("\0{input}").as_bytes())
4 .expect("valid input capabilities")
8 const GITHUB_CAPABILITIES
: &str = "multi_ack thin-pack side-band ofs-delta shallow deepen-since deepen-not deepen-relative no-progress include-tag allow-tip-sha1-in-want allow-reachable-sha1-in-want no-done symref=HEAD:refs/heads/main filter agent=git/github-gdf51a71f0236";
10 mod default_features
{
12 command
::tests
::v1
::{capabilities, GITHUB_CAPABILITIES}
,
17 fn it_chooses_the_best_multi_ack_and_sideband() {
19 Command
::Fetch
.default_features(
20 gix_transport
::Protocol
::V1
,
21 &capabilities("multi_ack side-band side-band-64k multi_ack_detailed")
23 &[("side-band-64k", None
), ("multi_ack_detailed", None
),]
28 fn it_chooses_all_supported_non_stacking_capabilities_and_leaves_no_progress() {
30 Command
::Fetch
.default_features(gix_transport
::Protocol
::V1
, &capabilities(GITHUB_CAPABILITIES
)),
37 ("deepen-since", None
),
39 ("deepen-relative", None
),
40 ("include-tag", None
),
41 ("allow-tip-sha1-in-want", None
),
42 ("allow-reachable-sha1-in-want", None
),
46 "we don't enforce no-progress"
54 use gix_transport
::client
::Capabilities
;
56 fn capabilities(command
: &str, input
: &str) -> Capabilities
{
57 Capabilities
::from_lines(format
!("version 2\n{command}={input}").into())
58 .expect("valid input for V2 capabilities")
62 mod default_features
{
63 use crate::{command::tests::v2::capabilities, Command}
;
68 Command
::Fetch
.default_features(
69 gix_transport
::Protocol
::V2
,
70 &capabilities("fetch", "shallow filter ref-in-want sideband-all packfile-uris")
72 ["shallow", "filter", "ref-in-want", "sideband-all", "packfile-uris"]
80 mod initial_arguments
{
83 use crate::{command::tests::v2::capabilities, Command}
;
86 fn for_all_features() {
88 Command
::Fetch
.initial_arguments(&Command
::Fetch
.default_features(
89 gix_transport
::Protocol
::V2
,
90 &capabilities("fetch", "shallow filter sideband-all packfile-uris")
92 ["thin-pack", "ofs-delta", "sideband-all"]
94 .map(|s
| s
.as_bytes().as_bstr().to_owned())
96 "packfile-uris isn't really supported that well and we don't support it either yet"
103 mod default_features
{
104 use crate::{command::tests::v2::capabilities, Command}
;
107 fn default_as_there_are_no_features() {
109 Command
::LsRefs
.default_features(
110 gix_transport
::Protocol
::V2
,
111 &capabilities("something-else", "does not matter as there are none")
121 use crate::{command::tests::v2::capabilities, Command}
;
124 fn ref_prefixes_can_always_be_used() {
125 Command
::LsRefs
.validate_argument_prefixes_or_panic(
126 gix_transport
::Protocol
::V2
,
127 &capabilities("something else", "do-not-matter"),
128 &[b
"ref-prefix hello/".as_bstr().into()],
135 fn unknown_argument() {
136 Command
::LsRefs
.validate_argument_prefixes_or_panic(
137 gix_transport
::Protocol
::V2
,
138 &capabilities("other", "do-not-matter"),
139 &[b
"definitely-nothing-we-know".as_bstr().into()],
146 fn unknown_feature() {
147 Command
::LsRefs
.validate_argument_prefixes_or_panic(
148 gix_transport
::Protocol
::V2
,
149 &capabilities("other", "do-not-matter"),
151 &[("some-feature-that-does-not-exist", None
)],