mirror of
https://git.alemi.dev/tci.git
synced 2024-11-23 16:44:48 +01:00
chore: removed imports
This commit is contained in:
parent
c07f4ed1e7
commit
01ec9c5c5a
1 changed files with 3 additions and 7 deletions
10
src/main.rs
10
src/main.rs
|
@ -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(),
|
||||
|
|
Loading…
Reference in a new issue