fix: fail git clone by case empty folder
Signed-off-by: Pakin <pakin.t@forth.co.th>
This commit is contained in:
parent
166b7079ca
commit
caa0833ea2
1 changed files with 14 additions and 2 deletions
16
src/main.rs
16
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())?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue