@@ -44,7 +44,7 @@ pub struct FetchOptions<'cb> {
44
44
depth : i32 ,
45
45
proxy : Option < ProxyOptions < ' cb > > ,
46
46
prune : FetchPrune ,
47
- update_fetchhead : bool ,
47
+ update_flags : RemoteUpdateFlags ,
48
48
download_tags : AutotagOption ,
49
49
follow_redirects : RemoteRedirect ,
50
50
custom_headers : Vec < CString > ,
@@ -507,7 +507,7 @@ impl<'cb> FetchOptions<'cb> {
507
507
callbacks : None ,
508
508
proxy : None ,
509
509
prune : FetchPrune :: Unspecified ,
510
- update_fetchhead : true ,
510
+ update_flags : RemoteUpdateFlags :: UPDATE_FETCHHEAD ,
511
511
download_tags : AutotagOption :: Unspecified ,
512
512
follow_redirects : RemoteRedirect :: Initial ,
513
513
custom_headers : Vec :: new ( ) ,
@@ -538,7 +538,17 @@ impl<'cb> FetchOptions<'cb> {
538
538
///
539
539
/// Defaults to `true`.
540
540
pub fn update_fetchhead ( & mut self , update : bool ) -> & mut Self {
541
- self . update_fetchhead = update;
541
+ self . update_flags
542
+ . set ( RemoteUpdateFlags :: UPDATE_FETCHHEAD , update) ;
543
+ self
544
+ }
545
+
546
+ /// Set whether to report unchanged tips in the update_tips callback.
547
+ ///
548
+ /// Defaults to `false`.
549
+ pub fn report_unchanged ( & mut self , update : bool ) -> & mut Self {
550
+ self . update_flags
551
+ . set ( RemoteUpdateFlags :: REPORT_UNCHANGED , update) ;
542
552
self
543
553
}
544
554
@@ -603,7 +613,11 @@ impl<'cb> Binding for FetchOptions<'cb> {
603
613
. map ( |m| m. raw ( ) )
604
614
. unwrap_or_else ( || ProxyOptions :: new ( ) . raw ( ) ) ,
605
615
prune : crate :: call:: convert ( & self . prune ) ,
606
- update_fetchhead : crate :: call:: convert ( & self . update_fetchhead ) ,
616
+ // HACK: `libgit2` uses C bitfields, which do not have a guaranteed memory layout.
617
+ // Reversing the bits ensures that the bitfields are set whether the bits are laid out
618
+ // from left to right or right to left, but will not work on other memory layouts.
619
+ update_flags : ( self . update_flags . bits ( ) | self . update_flags . bits ( ) . reverse_bits ( ) )
620
+ as c_uint ,
607
621
download_tags : crate :: call:: convert ( & self . download_tags ) ,
608
622
depth : self . depth ,
609
623
follow_redirects : self . follow_redirects . raw ( ) ,
0 commit comments