diff --git a/libgit2-sys/lib.rs b/libgit2-sys/lib.rs index b81d2eaa12..ad04cac7ed 100644 --- a/libgit2-sys/lib.rs +++ b/libgit2-sys/lib.rs @@ -706,6 +706,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 cb7d033896..6949d094e2 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 c27a74f9a0..b1c80de306 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, @@ -1564,8 +1568,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 58837ee013..ed854e9d09 100644 --- a/systest/build.rs +++ b/systest/build.rs @@ -33,6 +33,9 @@ fn main() { _ => false, }); + // 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");