fix: fail git clone by case empty folder

Signed-off-by: Pakin <pakin.t@forth.co.th>
This commit is contained in:
Pakin 2026-05-08 15:43:13 +07:00
parent 166b7079ca
commit caa0833ea2

View file

@ -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())?;