-
Notifications
You must be signed in to change notification settings - Fork 413
Expose git_merge_file function from libgit2 to repo.rs of git2-rs #635
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
57766bc
6ba9e96
2b5b1dd
0736d2c
ed71b2d
ea795f5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -98,7 +98,9 @@ pub use crate::index::{ | |
}; | ||
pub use crate::indexer::{IndexerProgress, Progress}; | ||
pub use crate::mempack::Mempack; | ||
pub use crate::merge::{AnnotatedCommit, MergeOptions}; | ||
pub use crate::merge::{ | ||
AnnotatedCommit, MergeFileInput, MergeFileOptions, MergeFileResult, MergeOptions, | ||
}; | ||
pub use crate::message::{message_prettify, DEFAULT_COMMENT_CHAR}; | ||
pub use crate::note::{Note, Notes}; | ||
pub use crate::object::Object; | ||
|
@@ -1049,6 +1051,34 @@ pub enum FileMode { | |
Commit, | ||
} | ||
|
||
impl From<u32> for FileMode { | ||
fn from(mode: u32) -> 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 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
} | ||
} | ||
|
||
impl Into<u32> for FileMode { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FWIW this is typically phrase as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So we don't need |
||
fn into(self) -> u32 { | ||
let ret = match self { | ||
FileMode::Unreadable => raw::GIT_FILEMODE_UNREADABLE, | ||
FileMode::Tree => raw::GIT_FILEMODE_TREE, | ||
FileMode::Blob => raw::GIT_FILEMODE_BLOB, | ||
FileMode::BlobExecutable => raw::GIT_FILEMODE_BLOB_EXECUTABLE, | ||
FileMode::Link => raw::GIT_FILEMODE_LINK, | ||
FileMode::Commit => raw::GIT_FILEMODE_COMMIT, | ||
}; | ||
ret as u32 | ||
} | ||
} | ||
|
||
bitflags! { | ||
/// Return codes for submodule status. | ||
/// | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this get merged (hah!) with the general block of function definitions elsewhere in this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was worrying to make it mess at the beginning so they were put together, now they've been moved to the right places.