pub enum TreeItemMode {
Blob,
BlobExecutable,
Tree,
Commit,
Link,
}Expand description
In Git, the mode field in a tree object’s entry specifies the type of the object represented by that entry. The mode is a three-digit octal number that encodes both the permissions and the type of the object. The first digit specifies the object type, and the remaining two digits specify the file mode or permissions.
Variants§
Implementations§
Source§impl TreeItemMode
impl TreeItemMode
Sourcepub fn tree_item_type_from_bytes(mode: &[u8]) -> Result<TreeItemMode, GitError>
pub fn tree_item_type_from_bytes(mode: &[u8]) -> Result<TreeItemMode, GitError>
Convert a 32-bit mode to a TreeItemType
§|0100000000000000| (040000)| Directory| |1000000110100100| (100644)| Regular non-executable file| |1000000110110100| (100664)| Regular non-executable group-writeable file| |1000000111101101| (100755)| Regular executable file| |1010000000000000| (120000)| Symbolic link| |1110000000000000| (160000)| Gitlink|
§GitLink
Gitlink, also known as a submodule, is a feature in Git that allows you to include a Git repository as a subdirectory within another Git repository. This is useful when you want to incorporate code from another project into your own project, without having to manually copy the code into your repository.
When you add a submodule to your Git repository, Git stores a reference to the other repository at a specific commit. This means that your repository will always point to a specific version of the other repository, even if changes are made to the submodule’s code in the future.
To work with a submodule in Git, you use commands like git submodule add, git submodule update, and git submodule init. These commands allow you to add a submodule to your repository, update it to the latest version, and initialize it for use.
Submodules can be a powerful tool for managing dependencies between different projects and components. However, they can also add complexity to your workflow, so it’s important to understand how they work and when to use them.
Sourcepub fn to_bytes(self) -> &'static [u8] ⓘ
pub fn to_bytes(self) -> &'static [u8] ⓘ
32-bit mode, split into (high to low bits):
- 4-bit object type: valid values in binary are 1000 (regular file), 1010 (symbolic link) and 1110 (gitlink)
- 3-bit unused
- 9-bit unix permission: Only 0755 and 0644 are valid for regular files. Symbolic links and gitlink have value 0 in this field.
Trait Implementations§
Source§impl<'__de, __Context> BorrowDecode<'__de, __Context> for TreeItemMode
impl<'__de, __Context> BorrowDecode<'__de, __Context> for TreeItemMode
Source§fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>(
decoder: &mut __D,
) -> Result<Self, DecodeError>
fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>( decoder: &mut __D, ) -> Result<Self, DecodeError>
Source§impl Clone for TreeItemMode
impl Clone for TreeItemMode
Source§fn clone(&self) -> TreeItemMode
fn clone(&self) -> TreeItemMode
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TreeItemMode
impl Debug for TreeItemMode
Source§impl<__Context> Decode<__Context> for TreeItemMode
impl<__Context> Decode<__Context> for TreeItemMode
Source§impl<'de> Deserialize<'de> for TreeItemMode
impl<'de> Deserialize<'de> for TreeItemMode
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for TreeItemMode
impl Display for TreeItemMode
Source§impl Encode for TreeItemMode
impl Encode for TreeItemMode
Source§impl Hash for TreeItemMode
impl Hash for TreeItemMode
Source§impl PartialEq for TreeItemMode
impl PartialEq for TreeItemMode
Source§impl Serialize for TreeItemMode
impl Serialize for TreeItemMode
impl Copy for TreeItemMode
impl Eq for TreeItemMode
impl StructuralPartialEq for TreeItemMode
Auto Trait Implementations§
impl Freeze for TreeItemMode
impl RefUnwindSafe for TreeItemMode
impl Send for TreeItemMode
impl Sync for TreeItemMode
impl Unpin for TreeItemMode
impl UnwindSafe for TreeItemMode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> FileLoadStore for Twhere
T: Serialize + for<'a> Deserialize<'a>,
impl<T> FileLoadStore for Twhere
T: Serialize + for<'a> Deserialize<'a>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more