1
1
use crate :: remote:: fetch;
2
- use gix_refspec:: RefSpec ;
3
2
4
3
/// The way the negotiation is performed
5
4
#[ derive( Copy , Clone ) ]
@@ -28,19 +27,15 @@ pub(crate) fn one_round(
28
27
fetch_tags : crate :: remote:: fetch:: Tags ,
29
28
arguments : & mut gix_protocol:: fetch:: Arguments ,
30
29
_previous_response : Option < & gix_protocol:: fetch:: Response > ,
31
- wants_shallow_change : Option < ( & fetch:: Shallow , & [ RefSpec ] ) > ,
30
+ shallow : Option < & fetch:: Shallow > ,
32
31
) -> Result < bool , Error > {
33
32
let tag_refspec_to_ignore = fetch_tags
34
33
. to_refspec ( )
35
34
. filter ( |_| matches ! ( fetch_tags, crate :: remote:: fetch:: Tags :: Included ) ) ;
36
- let ( shallow, non_wildcard_specs_only) = wants_shallow_change
37
- . map ( |( a, b) | ( Some ( a) , Some ( b) ) )
38
- . unwrap_or_default ( ) ;
39
-
40
- if let Some ( shallow) = shallow {
41
- if * shallow == fetch:: Shallow :: Deepen ( 0 ) {
42
- return Ok ( true ) ;
43
- }
35
+ if let Some ( fetch:: Shallow :: Deepen ( 0 ) ) = shallow {
36
+ // Avoid deepening (relative) with zero as it seems to upset the server. Git also doesn't actually
37
+ // perform the negotiation for some reason (couldn't find it in code).
38
+ return Ok ( true ) ;
44
39
}
45
40
46
41
match algo {
@@ -57,14 +52,6 @@ pub(crate) fn one_round(
57
52
} ) {
58
53
continue ;
59
54
}
60
- if non_wildcard_specs_only
61
- . and_then ( |refspecs| mapping. spec_index . get ( refspecs, & ref_map. extra_refspecs ) )
62
- . map_or ( false , |spec| {
63
- spec. to_ref ( ) . local ( ) . map_or ( false , |ref_| ref_. contains ( & b'*' ) )
64
- } )
65
- {
66
- continue ;
67
- }
68
55
let have_id = mapping. local . as_ref ( ) . and_then ( |name| {
69
56
repo. find_reference ( name)
70
57
. ok ( )
@@ -73,7 +60,7 @@ pub(crate) fn one_round(
73
60
match have_id {
74
61
Some ( have_id) => {
75
62
if let Some ( want_id) = mapping. remote . as_id ( ) {
76
- if want_id != have_id || wants_shallow_change . is_some ( ) {
63
+ if want_id != have_id {
77
64
arguments. want ( want_id) ;
78
65
arguments. have ( have_id) ;
79
66
}
@@ -88,7 +75,7 @@ pub(crate) fn one_round(
88
75
}
89
76
}
90
77
91
- if has_missing_tracking_branch || ( wants_shallow_change . is_some ( ) && arguments. is_empty ( ) ) {
78
+ if has_missing_tracking_branch || ( shallow . is_some ( ) && arguments. is_empty ( ) ) {
92
79
if let Ok ( Some ( r) ) = repo. head_ref ( ) {
93
80
if let Some ( id) = r. target ( ) . try_id ( ) {
94
81
arguments. have ( id) ;
0 commit comments