From f89c9c2ca5d5d7ca16b7774c50e14b2c4144e75b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20K=C3=B6rber?= Date: Wed, 8 Jun 2022 17:05:42 +0200 Subject: [PATCH] Do not fail on empty clone target --- src/tree.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/tree.rs b/src/tree.rs index bf35179..1a1eb02 100644 --- a/src/tree.rs +++ b/src/tree.rs @@ -143,7 +143,13 @@ fn sync_repo(root_path: &Path, repo: &repo::Repo, init_worktree: bool) -> Result let mut newly_created = false; - if repo_path.exists() { + if repo_path.exists() + && repo_path + .read_dir() + .map_err(|error| error.to_string())? + .next() + .is_some() + { if repo.worktree_setup && !actual_git_directory.exists() { return Err(String::from( "Repo already exists, but is not using a worktree setup",