Skip to content

Commit 78872dd

Browse files
committed
remote: Update git_fetch_options to use bitflags instead of bitfields
See: - libgit2/libgit2#6800 - libgit2/libgit2#6806
1 parent 8640496 commit 78872dd

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

Diff for: libgit2-sys/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ pub struct git_fetch_options {
402402
pub version: c_int,
403403
pub callbacks: git_remote_callbacks,
404404
pub prune: git_fetch_prune_t,
405-
pub update_flags: c_uint,
405+
pub update_fetchhead: c_uint,
406406
pub download_tags: git_remote_autotag_option_t,
407407
pub proxy_opts: git_proxy_options,
408408
pub depth: c_int,

Diff for: src/remote.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -613,11 +613,10 @@ impl<'cb> Binding for FetchOptions<'cb> {
613613
.map(|m| m.raw())
614614
.unwrap_or_else(|| ProxyOptions::new().raw()),
615615
prune: crate::call::convert(&self.prune),
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,
616+
// `update_fetchhead` is an incorrectly named option which contains both
617+
// the `UPDATE_FETCHHEAD` and `REPORT_UNCHANGED` flags.
618+
// See https://github.com/libgit2/libgit2/pull/6806
619+
update_fetchhead: self.update_flags.bits() as c_uint,
621620
download_tags: crate::call::convert(&self.download_tags),
622621
depth: self.depth,
623622
follow_redirects: self.follow_redirects.raw(),

Diff for: systest/build.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ fn main() {
2525
// this field is marked as const which ctest complains about
2626
(struct_ == "git_rebase_operation" && f == "id") ||
2727
// the real name of this field is ref but that is a reserved keyword
28-
(struct_ == "git_worktree_add_options" && f == "reference") ||
29-
// the `update_flags` field consists of 2 bitfields
30-
(struct_ == "git_fetch_options" && f == "update_flags")
28+
(struct_ == "git_worktree_add_options" && f == "reference")
3129
});
3230
cfg.skip_signededness(|s| match s {
3331
s if s.ends_with("_cb") => true,

0 commit comments

Comments
 (0)