aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
authorTeddy Wing2020-09-16 01:58:58 +0200
committerTeddy Wing2020-09-16 02:01:46 +0200
commite68aa0dfd1a200ff781f19ddffd69d01d9796ad3 (patch)
tree7a4df375fcfe3070d9a47ce9944b08ba220b287b /src/main.rs
parentcefd5dc50548b846b2f383c1a0d2a5168cd2553a (diff)
downloadgit-todo-e68aa0dfd1a200ff781f19ddffd69d01d9796ad3.tar.bz2
write_since(): Take an arbitrary branch as input
Allow the branch to be parameterised instead of forcing the base to be the local "master" branch. Added the `Todos` struct to store a `Repository` reference, since we need this for both the base ref and the diff. Decided to take a `Tree` instead of a `Branch` because we might want to compare against an arbitrary ref and allow users to specify that ref on the command line.
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs
index 60f12d8..48e8f5d 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,8 +1,13 @@
#![warn(rust_2018_idioms)]
-use git_todo::write_since;
+use git2::Repository;
+
+use git_todo::Todos;
fn main() {
- write_since(&mut std::io::stdout());
+ let repo = Repository::open(".").unwrap();
+
+ let todos = Todos { repo: &repo };
+ todos.write_since(todos.master_tree(), &mut std::io::stdout());
}