diff --git a/libgit2-sys/lib.rs b/libgit2-sys/lib.rs index a113a29526..691753b26e 100644 --- a/libgit2-sys/lib.rs +++ b/libgit2-sys/lib.rs @@ -692,6 +692,7 @@ git_enum! { GIT_FILEMODE_UNREADABLE = 0o000000, GIT_FILEMODE_TREE = 0o040000, GIT_FILEMODE_BLOB = 0o100644, + GIT_FILEMODE_BLOB_GROUP_WRITABLE = 0o100664, GIT_FILEMODE_BLOB_EXECUTABLE = 0o100755, GIT_FILEMODE_LINK = 0o120000, GIT_FILEMODE_COMMIT = 0o160000, diff --git a/src/diff.rs b/src/diff.rs index 3d5b42d9dc..de1481d565 100644 --- a/src/diff.rs +++ b/src/diff.rs @@ -621,6 +621,7 @@ impl<'a> DiffFile<'a> { raw::GIT_FILEMODE_UNREADABLE => FileMode::Unreadable, raw::GIT_FILEMODE_TREE => FileMode::Tree, raw::GIT_FILEMODE_BLOB => FileMode::Blob, + raw::GIT_FILEMODE_BLOB_GROUP_WRITABLE => FileMode::BlobGroupWritable, raw::GIT_FILEMODE_BLOB_EXECUTABLE => FileMode::BlobExecutable, raw::GIT_FILEMODE_LINK => FileMode::Link, raw::GIT_FILEMODE_COMMIT => FileMode::Commit, diff --git a/src/lib.rs b/src/lib.rs index c297ffe444..df25092a9b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1098,6 +1098,8 @@ pub enum FileMode { Tree, /// Blob Blob, + /// Group writable blob. Obsolete mode kept for compatibility reasons + BlobGroupWritable, /// Blob executable BlobExecutable, /// Link @@ -1112,6 +1114,7 @@ impl From for i32 { FileMode::Unreadable => raw::GIT_FILEMODE_UNREADABLE as i32, FileMode::Tree => raw::GIT_FILEMODE_TREE as i32, FileMode::Blob => raw::GIT_FILEMODE_BLOB as i32, + FileMode::BlobGroupWritable => raw::GIT_FILEMODE_BLOB_GROUP_WRITABLE as i32, FileMode::BlobExecutable => raw::GIT_FILEMODE_BLOB_EXECUTABLE as i32, FileMode::Link => raw::GIT_FILEMODE_LINK as i32, FileMode::Commit => raw::GIT_FILEMODE_COMMIT as i32, @@ -1125,6 +1128,7 @@ impl From for u32 { FileMode::Unreadable => raw::GIT_FILEMODE_UNREADABLE as u32, FileMode::Tree => raw::GIT_FILEMODE_TREE as u32, FileMode::Blob => raw::GIT_FILEMODE_BLOB as u32, + FileMode::BlobGroupWritable => raw::GIT_FILEMODE_BLOB_GROUP_WRITABLE as u32, FileMode::BlobExecutable => raw::GIT_FILEMODE_BLOB_EXECUTABLE as u32, FileMode::Link => raw::GIT_FILEMODE_LINK as u32, FileMode::Commit => raw::GIT_FILEMODE_COMMIT as u32, @@ -1562,8 +1566,10 @@ mod tests { #[test] fn convert_filemode() { assert_eq!(i32::from(FileMode::Blob), 0o100644); + assert_eq!(i32::from(FileMode::BlobGroupWritable), 0o100664); assert_eq!(i32::from(FileMode::BlobExecutable), 0o100755); assert_eq!(u32::from(FileMode::Blob), 0o100644); + assert_eq!(u32::from(FileMode::BlobGroupWritable), 0o100664); assert_eq!(u32::from(FileMode::BlobExecutable), 0o100755); } } diff --git a/systest/build.rs b/systest/build.rs index eba93f3090..f0533cde25 100644 --- a/systest/build.rs +++ b/systest/build.rs @@ -39,6 +39,9 @@ fn main() { } }); + // GIT_FILEMODE_BLOB_GROUP_WRITABLE is not a public const in libgit2 + cfg.define("GIT_FILEMODE_BLOB_GROUP_WRITABLE", Some("0100664")); + // not entirely sure why this is failing... cfg.skip_roundtrip(|t| t == "git_clone_options" || t == "git_submodule_update_options");