$ git init repo
$ mkdir -p repo/aw/s-
$ echo '{"name":"aws-foo","vers":"0.0.1","deps":[],"cksum":"","features":{},"yanked":false}' > repo/aw/s-/aws-foo
$ git -C repo add .
$ git -C repo commit -m 'commit'
# note down the commit hash here
$ echo '{"name":"aws-foo","vers":"0.0.2","deps":[],"cksum":"","features":{},"yanked":false}' >> repo/aw/s-/aws-foo
$ git -C repo add .
$ git -C repo commit -m 'commit'
# note down this commit hash too
$ git -C repo remote add origin origin
$ git -C repo diff <first commit hash>..<second commit hash>
diff --git a/aw/s-/aws-foo b/aw/s-/aws-foo
index f512d82..9bff708 100644
--- a/aw/s-/aws-foo
+++ b/aw/s-/aws-foo
@@ -1 +1,2 @@
{"name":"aws-foo","vers":"0.0.1","deps":[],"cksum":"","features":{},"yanked":false}
+{"name":"aws-foo","vers":"0.0.2","deps":[],"cksum":"","features":{},"yanked":false}
$ cargo new --bin whatever && cd whatever
$ echo 'crates-index-diff = "15"' >> Cargo.toml
$ cat src/main.rs
use crates_index_diff::{git, index::CloneOptions, Index};
use std::sync::atomic::AtomicBool;
fn main() {
let repo = git::open("../repo").unwrap();
let origin_url = repo
.find_remote("origin")
.unwrap()
.url(git::remote::Direction::Fetch)
.unwrap()
.to_bstring()
.to_string();
let index = Index::from_path_or_cloned_with_options(
"../repo",
git::progress::Discard,
&AtomicBool::default(),
CloneOptions {
url: origin_url,
..Default::default()
},
)
.unwrap();
index.changes("<first commit hash>", "<second commit hash>").unwrap();
}
$ cargo r
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: DiffForEach(Diff(Cancelled))', src/main.rs:24:41
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace