chore: removed imports

This commit is contained in:
əlemi 2024-02-13 22:34:56 +01:00
parent c07f4ed1e7
commit 01ec9c5c5a
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -1,7 +1,3 @@
use std::{path::PathBuf, process::Command};
use git2::{Config, Repository};
#[derive(Debug, thiserror::Error)]
enum TciError {
#[error("could not understand file system structure, bailing out")]
@ -72,7 +68,7 @@ fn tci(cfg: TciConfig) -> Result<(), Box<dyn std::error::Error>> {
let repo_path = std::env::current_dir()?;
// check config before even creating temp dir and cloning repo
let git_config = Config::open(&repo_path.join("config"))?;
let git_config = git2::Config::open(&repo_path.join("config"))?;
let tci_script = git_config.get_str("tci.script").unwrap_or(".tci").to_string();
// check if CI is allowed
@ -100,7 +96,7 @@ fn tci(cfg: TciConfig) -> Result<(), Box<dyn std::error::Error>> {
Ok(())
}
fn tci_hook(repo_path: &PathBuf, tci_script: &str) -> Result<(), TciError> {
fn tci_hook(repo_path: &std::path::PathBuf, tci_script: &str) -> Result<(), TciError> {
// TODO kind of ew but ehh should do its job
let mut name = repo_path.to_string_lossy()
.replace(HOME.as_str(), "");
@ -114,7 +110,7 @@ fn tci_hook(repo_path: &PathBuf, tci_script: &str) -> Result<(), TciError> {
let tmp = tempdir::TempDir::new(&format!("tci-{name}"))?;
// TODO allow customizing clone? just clone recursive? just let hook setup submodules?
Repository::clone(
git2::Repository::clone(
repo_path.to_str()
.ok_or(TciError::FsError("repo path is not a valid string"))?,
tmp.path(),