Skip to content

Commit

Permalink
fix: fix test fixtures data
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Feb 24, 2021
1 parent 5a28816 commit 150ddbc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion e2e/_fixtures/no-plugin.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
repos:
- url: https://github.com/coco-rs/coco.fixtures
- url: https://github.com/coco-rs/coco.fixtures2
12 changes: 11 additions & 1 deletion src/infrastructure/git/git_repository.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,17 @@ impl GitRepository {
let _ = fs::create_dir_all(&local_path.parent().unwrap());
let repo = match Repository::clone(url, local_path) {
Ok(repo) => repo,
Err(e) => panic!("failed to clone: {}", e),
Err(e) => {
let exist_string = "exists and is not an empty directory";

if e.to_string().contains(exist_string) {
return match Repository::open(&local_path) {
Ok(repo) => repo,
Err(e) => panic!("failed to open: {}", e),
};
}
panic!("failed to clone: {}", e)
}
};

return repo;
Expand Down

0 comments on commit 150ddbc

Please sign in to comment.