git2-rs
git2-rs copied to clipboard
Expose git_merge_file function from libgit2 to repo.rs of git2-rs
@alexcrichton BTW, could you point out how I can fix the issue in CI / Test (windows)? Tried but have no idea.
Oh the windows error I think has to do with the fact that enums in C have a different signededness than other platforms. I think you can probably fix things with some casts?
I tried this, but doesn't work, any idea:
trait FileModeConvert {
type ValueType;
fn from(mode: Self::ValueType) -> Self;
}
impl FileModeConvert for FileMode {
#[cfg(target_env = "msvc")]
type ValueType = i32;
#[cfg(not(target_env = "msvc"))]
type ValueType = u32;
fn from(mode: Self::ValueType) -> Self {
match mode {
raw::GIT_FILEMODE_UNREADABLE => FileMode::Unreadable,
raw::GIT_FILEMODE_TREE => FileMode::Tree,
raw::GIT_FILEMODE_BLOB => FileMode::Blob,
raw::GIT_FILEMODE_BLOB_EXECUTABLE => FileMode::BlobExecutable,
raw::GIT_FILEMODE_LINK => FileMode::Link,
raw::GIT_FILEMODE_COMMIT => FileMode::Commit,
mode => panic!("unknown file mode: {}", mode),
}
}
}
@alexcrichton Can we merge this PR now? Thank you!