Skip to content

Add new blame options #633

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

Merged
merged 1 commit into from
Nov 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions libgit2-sys/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,8 @@ pub const GIT_BLAME_TRACK_COPIES_SAME_COMMIT_MOVES: u32 = 1 << 1;
pub const GIT_BLAME_TRACK_COPIES_SAME_COMMIT_COPIES: u32 = 1 << 2;
pub const GIT_BLAME_TRACK_COPIES_ANY_COMMIT_COPIES: u32 = 1 << 3;
pub const GIT_BLAME_FIRST_PARENT: u32 = 1 << 4;
pub const GIT_BLAME_USE_MAILMAP: u32 = 1 << 5;
pub const GIT_BLAME_IGNORE_WHITESPACE: u32 = 1 << 6;

#[repr(C)]
#[derive(Copy, Clone)]
Expand Down
12 changes: 12 additions & 0 deletions src/blame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,18 @@ impl BlameOptions {
self.flag(raw::GIT_BLAME_FIRST_PARENT, opt)
}

/// Use mailmap file to map author and committer names and email addresses
/// to canonical real names and email addresses. The mailmap will be read
/// from the working directory, or HEAD in a bare repository.
pub fn use_mailmap(&mut self, opt: bool) -> &mut BlameOptions {
self.flag(raw::GIT_BLAME_USE_MAILMAP, opt)
}

/// Ignore whitespace differences.
pub fn ignore_whitespace(&mut self, opt: bool) -> &mut BlameOptions {
self.flag(raw::GIT_BLAME_IGNORE_WHITESPACE, opt)
}

/// Setter for the id of the newest commit to consider.
pub fn newest_commit(&mut self, id: Oid) -> &mut BlameOptions {
unsafe {
Expand Down