diff --git a/src/remote.rs b/src/remote.rs index 427165dd7f..0211493507 100644 --- a/src/remote.rs +++ b/src/remote.rs @@ -613,7 +613,11 @@ impl<'cb> Binding for FetchOptions<'cb> { .map(|m| m.raw()) .unwrap_or_else(|| ProxyOptions::new().raw()), prune: crate::call::convert(&self.prune), - update_flags: self.update_flags.bits() as c_uint, + // HACK: `libgit2` uses C bitfields, which do not have a guaranteed memory layout. + // Reversing the bits ensures that the bitfields are set whether the bits are laid out + // from left to right or right to left, but will not work on other memory layouts. + update_flags: (self.update_flags.bits() | self.update_flags.bits().reverse_bits()) + as c_uint, download_tags: crate::call::convert(&self.download_tags), depth: self.depth, follow_redirects: self.follow_redirects.raw(),