File tree 8 files changed +15
-13
lines changed
8 files changed +15
-13
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ mod with_io {
60
60
match self {
61
61
Command :: LsRefs => & [ ] ,
62
62
Command :: Fetch => match version {
63
- gix_transport:: Protocol :: V1 => & [
63
+ gix_transport:: Protocol :: V0 | gix_transport :: Protocol :: V1 => & [
64
64
"multi_ack" ,
65
65
"thin-pack" ,
66
66
"side-band" ,
@@ -120,7 +120,7 @@ mod with_io {
120
120
) -> Vec < Feature > {
121
121
match self {
122
122
Command :: Fetch => match version {
123
- gix_transport:: Protocol :: V1 => {
123
+ gix_transport:: Protocol :: V0 | gix_transport :: Protocol :: V1 => {
124
124
let has_multi_ack_detailed = server_capabilities. contains ( "multi_ack_detailed" ) ;
125
125
let has_sideband_64k = server_capabilities. contains ( "side-band-64k" ) ;
126
126
self . all_features ( version)
@@ -173,7 +173,7 @@ mod with_io {
173
173
panic ! ( "{}: argument {} is not known or allowed" , self . as_str( ) , arg) ;
174
174
}
175
175
match version {
176
- gix_transport:: Protocol :: V1 => {
176
+ gix_transport:: Protocol :: V0 | gix_transport :: Protocol :: V1 => {
177
177
for ( feature, _) in features {
178
178
if server
179
179
. iter ( )
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ impl Arguments {
14
14
assert ! ( add_done_argument, "If there are no haves, is_done must be true." ) ;
15
15
}
16
16
match self . version {
17
- gix_transport:: Protocol :: V1 => {
17
+ gix_transport:: Protocol :: V0 | gix_transport :: Protocol :: V1 => {
18
18
let ( on_into_read, retained_state) = self . prepare_v1 (
19
19
transport. connection_persists_across_multiple_requests ( ) ,
20
20
add_done_argument,
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ impl Arguments {
15
15
assert ! ( add_done_argument, "If there are no haves, is_done must be true." ) ;
16
16
}
17
17
match self . version {
18
- gix_transport:: Protocol :: V1 => {
18
+ gix_transport:: Protocol :: V0 | gix_transport :: Protocol :: V1 => {
19
19
let ( on_into_read, retained_state) = self . prepare_v1 (
20
20
transport. connection_persists_across_multiple_requests ( ) ,
21
21
add_done_argument,
Original file line number Diff line number Diff line change @@ -173,7 +173,7 @@ impl Arguments {
173
173
let mut deepen_relative = shallow;
174
174
let supports_include_tag;
175
175
let ( initial_arguments, features_for_first_want) = match version {
176
- gix_transport:: Protocol :: V1 => {
176
+ gix_transport:: Protocol :: V0 | gix_transport :: Protocol :: V1 => {
177
177
deepen_since = has ( "deepen-since" ) ;
178
178
deepen_not = has ( "deepen-not" ) ;
179
179
deepen_relative = has ( "deepen-relative" ) ;
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ impl Response {
37
37
reader : & mut ( impl client:: ExtendedBufRead + Unpin ) ,
38
38
) -> Result < Response , response:: Error > {
39
39
match version {
40
- Protocol :: V1 => {
40
+ Protocol :: V0 | Protocol :: V1 => {
41
41
let mut line = String :: new ( ) ;
42
42
let mut acks = Vec :: < Acknowledgement > :: new ( ) ;
43
43
let mut shallows = Vec :: < ShallowUpdate > :: new ( ) ;
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ impl Response {
37
37
reader : & mut impl client:: ExtendedBufRead ,
38
38
) -> Result < Response , response:: Error > {
39
39
match version {
40
- Protocol :: V1 => {
40
+ Protocol :: V0 | Protocol :: V1 => {
41
41
let mut line = String :: new ( ) ;
42
42
let mut acks = Vec :: < Acknowledgement > :: new ( ) ;
43
43
let mut shallows = Vec :: < ShallowUpdate > :: new ( ) ;
Original file line number Diff line number Diff line change @@ -170,7 +170,7 @@ impl Response {
170
170
/// make it easy to maintain all versions with a single code base that aims to be and remain maintainable.
171
171
pub fn check_required_features ( version : Protocol , features : & [ Feature ] ) -> Result < ( ) , Error > {
172
172
match version {
173
- Protocol :: V1 => {
173
+ Protocol :: V0 | Protocol :: V1 => {
174
174
let has = |name : & str | features. iter ( ) . any ( |f| f. 0 == name) ;
175
175
// Let's focus on V2 standards, and simply not support old servers to keep our code simpler
176
176
if !has ( "multi_ack_detailed" ) {
Original file line number Diff line number Diff line change @@ -77,10 +77,12 @@ where
77
77
78
78
let parsed_refs = match refs {
79
79
Some ( mut refs) => {
80
- assert_eq ! (
81
- actual_protocol,
82
- gix_transport:: Protocol :: V1 ,
83
- "Only V1 auto-responds with refs"
80
+ assert ! (
81
+ matches!(
82
+ actual_protocol,
83
+ gix_transport:: Protocol :: V0 | gix_transport:: Protocol :: V1
84
+ ) ,
85
+ "Only V(0|1) auto-responds with refs"
84
86
) ;
85
87
Some (
86
88
refs:: from_v1_refs_received_as_part_of_handshake_and_capabilities ( & mut refs, capabilities. iter ( ) )
You can’t perform that action at this time.
0 commit comments