Skip to content

Commit

Permalink
doc(EntryMode): describe variants(#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Sep 22, 2021
1 parent 83d591d commit 899c579
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
6 changes: 5 additions & 1 deletion git-object/src/tree/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,16 @@ pub mod write;
#[derive(Clone, Copy, PartialEq, Eq, Debug, Ord, PartialOrd, Hash)]
#[repr(u16)]
#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]
#[allow(missing_docs)]
pub enum EntryMode {
/// A tree, or directory
Tree = 0o040000u16,
/// A file that is not executable
Blob = 0o100644,
/// A file that is executable
BlobExecutable = 0o100755,
/// A symbolic link
Link = 0o120000,
/// A commit of a git submodule
Commit = 0o160000,
}

Expand Down
13 changes: 13 additions & 0 deletions git-object/tests/immutable/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,16 @@ mod from_bytes {
Ok(())
}
}

mod entry_mode {
use git_object::tree::EntryMode;

#[test]
fn size_in_bytes() {
assert_eq!(
std::mem::size_of::<EntryMode>(),
2,
"it should not change without notiice"
);
}
}

0 comments on commit 899c579

Please sign in to comment.