@@ -10,6 +10,7 @@ pub struct Options {
10
10
pub ref_specs : Vec < BString > ,
11
11
pub shallow : gix:: remote:: fetch:: Shallow ,
12
12
pub handshake_info : bool ,
13
+ pub negotiation_info : bool ,
13
14
}
14
15
15
16
pub const PROGRESS_RANGE : std:: ops:: RangeInclusive < u8 > = 1 ..=3 ;
@@ -31,6 +32,7 @@ pub(crate) mod function {
31
32
dry_run,
32
33
remote,
33
34
handshake_info,
35
+ negotiation_info,
34
36
shallow,
35
37
ref_specs,
36
38
} : Options ,
@@ -66,27 +68,37 @@ pub(crate) mod function {
66
68
update_refs,
67
69
negotiate,
68
70
dry_run : _,
69
- } => print_updates (
70
- & repo,
71
- negotiate. unwrap_or_default ( ) ,
72
- update_refs,
73
- ref_specs,
74
- res. ref_map ,
75
- & mut out,
76
- err,
77
- ) ,
71
+ } => {
72
+ let negotiate_default = Default :: default ( ) ;
73
+ print_updates (
74
+ & repo,
75
+ negotiate. as_ref ( ) . unwrap_or ( & negotiate_default) ,
76
+ update_refs,
77
+ ref_specs,
78
+ res. ref_map ,
79
+ & mut out,
80
+ err,
81
+ ) ?;
82
+ if negotiation_info {
83
+ print_negotiate_info ( & mut out, negotiate. as_ref ( ) ) ?;
84
+ }
85
+ Ok :: < _ , anyhow:: Error > ( ( ) )
86
+ }
78
87
Status :: Change {
79
88
update_refs,
80
89
write_pack_bundle,
81
90
negotiate,
82
91
} => {
83
- print_updates ( & repo, negotiate, update_refs, ref_specs, res. ref_map , & mut out, err) ?;
92
+ print_updates ( & repo, & negotiate, update_refs, ref_specs, res. ref_map , & mut out, err) ?;
84
93
if let Some ( data_path) = write_pack_bundle. data_path {
85
94
writeln ! ( out, "pack file: \" {}\" " , data_path. display( ) ) . ok ( ) ;
86
95
}
87
96
if let Some ( index_path) = write_pack_bundle. index_path {
88
97
writeln ! ( out, "index file: \" {}\" " , index_path. display( ) ) . ok ( ) ;
89
98
}
99
+ if negotiation_info {
100
+ print_negotiate_info ( & mut out, Some ( & negotiate) ) ?;
101
+ }
90
102
Ok ( ( ) )
91
103
}
92
104
} ?;
@@ -96,9 +108,23 @@ pub(crate) mod function {
96
108
Ok ( ( ) )
97
109
}
98
110
111
+ fn print_negotiate_info (
112
+ mut out : impl std:: io:: Write ,
113
+ negotiate : Option < & gix:: remote:: fetch:: outcome:: Negotiate > ,
114
+ ) -> std:: io:: Result < ( ) > {
115
+ writeln ! ( out, "Negotiation Phase Information" ) ?;
116
+ match negotiate {
117
+ Some ( negotiate) => {
118
+ writeln ! ( out, "\t {:?}" , negotiate. rounds) ?;
119
+ writeln ! ( out, "\t num commits traversed in graph: {}" , negotiate. graph. len( ) )
120
+ }
121
+ None => writeln ! ( out, "\t no negotiation performed" ) ,
122
+ }
123
+ }
124
+
99
125
pub ( crate ) fn print_updates (
100
126
repo : & gix:: Repository ,
101
- negotiate : gix:: remote:: fetch:: outcome:: Negotiate ,
127
+ negotiate : & gix:: remote:: fetch:: outcome:: Negotiate ,
102
128
update_refs : gix:: remote:: fetch:: refs:: update:: Outcome ,
103
129
refspecs : & [ gix:: refspec:: RefSpec ] ,
104
130
mut map : gix:: remote:: fetch:: RefMap ,
0 commit comments