From caa0833ea24da5ddae16074f39622948aaeafc50 Mon Sep 17 00:00:00 2001 From: Pakin Date: Fri, 8 May 2026 15:43:13 +0700 Subject: [PATCH] fix: fail git clone by case empty folder Signed-off-by: Pakin --- src/main.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 4a905d8..91de988 100644 --- a/src/main.rs +++ b/src/main.rs @@ -34,9 +34,21 @@ async fn main() -> gcm::StandardResult { match std::fs::read_dir(config.get("GIT_REPO_LOCAL_DEST").expect("not exist")) { Ok(_) => { info!( - "GIT_REPO `{dest}` already setup", + "GIT_REPO `{dest}` existed, checking if has git", dest = config.get("GIT_REPO_LOCAL_DEST").unwrap() - ) + ); + + match std::fs::read_dir(format!( + "{}/.git", + config.get("GIT_REPO_LOCAL_DEST").expect("not exist") + )) { + Ok(_) => { + info!("GIT REPO already set up!") + } + Err(_) => { + setup_git_repo(config.clone())?; + } + } } Err(_) => { setup_git_repo(config.clone())?;