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 {
}
self
}
+
+ /// The first line in the file to blame.
+ pub fn min_line(&mut self, lineno: usize) -> &mut BlameOptions {
+ self.raw.min_line = lineno;
+ self
+ }
+
+ /// The last line in the file to blame.
+ pub fn max_line(&mut self, lineno: usize) -> &mut BlameOptions {
+ self.raw.max_line = lineno;
+ self
+ }
}
impl<'repo> Binding for Blame<'repo> {
let (_td, repo) = crate::test::repo_init();
let mut index = repo.index().unwrap();
- let root = repo.path().parent().unwrap();
+ let root = repo.workdir().unwrap();
fs::create_dir(&root.join("foo")).unwrap();
File::create(&root.join("foo/bar")).unwrap();
index.add_path(Path::new("foo/bar")).unwrap();