@@ -79,7 +79,7 @@ dce0ea858eef7ff61ad345cc5cdac62203fb3c10 refs/tags/gix-commitgraph-v0.0.0
79
79
21c9b7500cb144b3169a6537961ec2b9e865be81 refs/tags/gix-commitgraph-v0.0.0^{}"
80
80
. as_bytes ( ) ,
81
81
) ;
82
- let out = refs:: from_v1_refs_received_as_part_of_handshake_and_capabilities (
82
+ let ( out, shallow ) = refs:: from_v1_refs_received_as_part_of_handshake_and_capabilities (
83
83
input,
84
84
Capabilities :: from_bytes ( b"\0 symref=HEAD:refs/heads/main symref=MISSING_NAMESPACE_TARGET:(null)" )
85
85
. expect ( "valid capabilities" )
@@ -88,6 +88,68 @@ dce0ea858eef7ff61ad345cc5cdac62203fb3c10 refs/tags/gix-commitgraph-v0.0.0
88
88
)
89
89
. await
90
90
. expect ( "no failure from valid input" ) ;
91
+ assert ! ( shallow. is_empty( ) ) ;
92
+ assert_eq ! (
93
+ out,
94
+ vec![
95
+ Ref :: Symbolic {
96
+ full_ref_name: "HEAD" . into( ) ,
97
+ target: "refs/heads/main" . into( ) ,
98
+ tag: None ,
99
+ object: oid( "73a6868963993a3328e7d8fe94e5a6ac5078a944" )
100
+ } ,
101
+ Ref :: Direct {
102
+ full_ref_name: "MISSING_NAMESPACE_TARGET" . into( ) ,
103
+ object: oid( "21c9b7500cb144b3169a6537961ec2b9e865be81" )
104
+ } ,
105
+ Ref :: Direct {
106
+ full_ref_name: "refs/heads/main" . into( ) ,
107
+ object: oid( "73a6868963993a3328e7d8fe94e5a6ac5078a944" )
108
+ } ,
109
+ Ref :: Direct {
110
+ full_ref_name: "refs/pull/13/head" . into( ) ,
111
+ object: oid( "8e472f9ccc7d745927426cbb2d9d077de545aa4e" )
112
+ } ,
113
+ Ref :: Peeled {
114
+ full_ref_name: "refs/tags/gix-commitgraph-v0.0.0" . into( ) ,
115
+ tag: oid( "dce0ea858eef7ff61ad345cc5cdac62203fb3c10" ) ,
116
+ object: oid( "21c9b7500cb144b3169a6537961ec2b9e865be81" )
117
+ } ,
118
+ ]
119
+ ) ;
120
+ }
121
+
122
+ #[ maybe_async:: test( feature = "blocking-client" , async ( feature = "async-client" , async_std:: test) ) ]
123
+ async fn extract_references_from_v1_refs_with_shallow ( ) {
124
+ use crate :: fetch:: response:: ShallowUpdate ;
125
+ let input = & mut Fixture (
126
+ "73a6868963993a3328e7d8fe94e5a6ac5078a944 HEAD
127
+ 21c9b7500cb144b3169a6537961ec2b9e865be81 MISSING_NAMESPACE_TARGET
128
+ 73a6868963993a3328e7d8fe94e5a6ac5078a944 refs/heads/main
129
+ 8e472f9ccc7d745927426cbb2d9d077de545aa4e refs/pull/13/head
130
+ dce0ea858eef7ff61ad345cc5cdac62203fb3c10 refs/tags/gix-commitgraph-v0.0.0
131
+ 21c9b7500cb144b3169a6537961ec2b9e865be81 refs/tags/gix-commitgraph-v0.0.0^{}
132
+ shallow 21c9b7500cb144b3169a6537961ec2b9e865be81
133
+ shallow dce0ea858eef7ff61ad345cc5cdac62203fb3c10"
134
+ . as_bytes ( ) ,
135
+ ) ;
136
+ let ( out, shallow) = refs:: from_v1_refs_received_as_part_of_handshake_and_capabilities (
137
+ input,
138
+ Capabilities :: from_bytes ( b"\0 symref=HEAD:refs/heads/main symref=MISSING_NAMESPACE_TARGET:(null)" )
139
+ . expect ( "valid capabilities" )
140
+ . 0
141
+ . iter ( ) ,
142
+ )
143
+ . await
144
+ . expect ( "no failure from valid input" ) ;
145
+
146
+ assert_eq ! (
147
+ shallow,
148
+ vec![
149
+ ShallowUpdate :: Shallow ( oid( "21c9b7500cb144b3169a6537961ec2b9e865be81" ) ) ,
150
+ ShallowUpdate :: Shallow ( oid( "dce0ea858eef7ff61ad345cc5cdac62203fb3c10" ) )
151
+ ]
152
+ ) ;
91
153
assert_eq ! (
92
154
out,
93
155
vec![
0 commit comments