after execute command : git fetch and git diff --name-status master origin/master
i can see the differencies between the master and origin/master
but i try to run the below code, it's nothing.
let binding = repo.revparse_single("master").unwrap();
let local = binding.as_tree();
let binding = repo.revparse_single(r"origin/master").unwrap();
let remote = binding.as_tree();
let _ = match repo.diff_tree_to_tree(local, remote, Some(&mut DiffOptions::new())) {
Ok(diff) => {
println!("{:?}", diff.stats());
let _ = diff.print(DiffFormat::NameStatus, |delta, _hunk, _line| {
println!(
"{:?} {} {}",
delta.flags(),
delta.new_file().path().unwrap().display(),
delta.old_file().path().unwrap().display(),
);
return true;
});
}
Err(_) => todo!(),
};
thanks.