diff options
Diffstat (limited to 'src/git.rs')
| -rw-r--r-- | src/git.rs | 8 |
1 files changed, 4 insertions, 4 deletions
| @@ -1,6 +1,7 @@ | |||
| 1 | #[cfg(test)] | 1 | use std::{ |
| 2 | use std::path::PathBuf; | 2 | env::current_dir, |
| 3 | use std::{env::current_dir, path::Path}; | 3 | path::{Path, PathBuf}, |
| 4 | }; | ||
| 4 | 5 | ||
| 5 | use anyhow::{bail, Context, Result}; | 6 | use anyhow::{bail, Context, Result}; |
| 6 | use git2::{DiffOptions, Oid, Revwalk}; | 7 | use git2::{DiffOptions, Oid, Revwalk}; |
| @@ -18,7 +19,6 @@ impl Repo { | |||
| 18 | git_repo: git2::Repository::discover(current_dir()?)?, | 19 | git_repo: git2::Repository::discover(current_dir()?)?, |
| 19 | }) | 20 | }) |
| 20 | } | 21 | } |
| 21 | #[cfg(test)] | ||
| 22 | pub fn from_path(path: &PathBuf) -> Result<Self> { | 22 | pub fn from_path(path: &PathBuf) -> Result<Self> { |
| 23 | Ok(Self { | 23 | Ok(Self { |
| 24 | git_repo: git2::Repository::open(path)?, | 24 | git_repo: git2::Repository::open(path)?, |