diff --git a/libgit2-sys/lib.rs b/libgit2-sys/lib.rs index 2ea565284f..c94d0d446a 100644 --- a/libgit2-sys/lib.rs +++ b/libgit2-sys/lib.rs @@ -402,7 +402,7 @@ pub struct git_fetch_options { pub version: c_int, pub callbacks: git_remote_callbacks, pub prune: git_fetch_prune_t, - pub update_flags: c_uint, + pub update_fetchhead: c_uint, pub download_tags: git_remote_autotag_option_t, pub proxy_opts: git_proxy_options, pub depth: c_int, diff --git a/src/remote.rs b/src/remote.rs index 0211493507..13c275ae2e 100644 --- a/src/remote.rs +++ b/src/remote.rs @@ -613,11 +613,10 @@ impl<'cb> Binding for FetchOptions<'cb> { .map(|m| m.raw()) .unwrap_or_else(|| ProxyOptions::new().raw()), prune: crate::call::convert(&self.prune), - // 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, + // `update_fetchhead` is an incorrectly named option which contains both + // the `UPDATE_FETCHHEAD` and `REPORT_UNCHANGED` flags. + // See https://github.com/libgit2/libgit2/pull/6806 + update_fetchhead: self.update_flags.bits() as c_uint, download_tags: crate::call::convert(&self.download_tags), depth: self.depth, follow_redirects: self.follow_redirects.raw(), diff --git a/systest/build.rs b/systest/build.rs index 0a22a5b396..85e8b4b437 100644 --- a/systest/build.rs +++ b/systest/build.rs @@ -25,9 +25,7 @@ fn main() { // this field is marked as const which ctest complains about (struct_ == "git_rebase_operation" && f == "id") || // the real name of this field is ref but that is a reserved keyword - (struct_ == "git_worktree_add_options" && f == "reference") || - // the `update_flags` field consists of 2 bitfields - (struct_ == "git_fetch_options" && f == "update_flags") + (struct_ == "git_worktree_add_options" && f == "reference") }); cfg.skip_signededness(|s| match s { s if s.ends_with("_cb") => true,