Skip to content

Commit 73eee9d

Browse files
authored
Add new blame options (#633)
1 parent b830b24 commit 73eee9d

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

libgit2-sys/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,8 @@ pub const GIT_BLAME_TRACK_COPIES_SAME_COMMIT_MOVES: u32 = 1 << 1;
714714
pub const GIT_BLAME_TRACK_COPIES_SAME_COMMIT_COPIES: u32 = 1 << 2;
715715
pub const GIT_BLAME_TRACK_COPIES_ANY_COMMIT_COPIES: u32 = 1 << 3;
716716
pub const GIT_BLAME_FIRST_PARENT: u32 = 1 << 4;
717+
pub const GIT_BLAME_USE_MAILMAP: u32 = 1 << 5;
718+
pub const GIT_BLAME_IGNORE_WHITESPACE: u32 = 1 << 6;
717719

718720
#[repr(C)]
719721
#[derive(Copy, Clone)]

src/blame.rs

+12
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,18 @@ impl BlameOptions {
201201
self.flag(raw::GIT_BLAME_FIRST_PARENT, opt)
202202
}
203203

204+
/// Use mailmap file to map author and committer names and email addresses
205+
/// to canonical real names and email addresses. The mailmap will be read
206+
/// from the working directory, or HEAD in a bare repository.
207+
pub fn use_mailmap(&mut self, opt: bool) -> &mut BlameOptions {
208+
self.flag(raw::GIT_BLAME_USE_MAILMAP, opt)
209+
}
210+
211+
/// Ignore whitespace differences.
212+
pub fn ignore_whitespace(&mut self, opt: bool) -> &mut BlameOptions {
213+
self.flag(raw::GIT_BLAME_IGNORE_WHITESPACE, opt)
214+
}
215+
204216
/// Setter for the id of the newest commit to consider.
205217
pub fn newest_commit(&mut self, id: Oid) -> &mut BlameOptions {
206218
unsafe {

0 commit comments

Comments
 (0)