Skip to content

Commit

Permalink
Avoid nesting cloned OGM repos inside themselves
Browse files Browse the repository at this point in the history
Providing both `directory` and `path` to Git.clone results in
the repo being cloned into a directory nested inside itself.

This may be a fix for #144.
  • Loading branch information
thatbudakguy committed Mar 27, 2023
1 parent c2c5427 commit 6470322
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/geo_combine/harvester.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def clone(repo = nil)
return 0 if File.directory? repo_path

repo_url = "https://github.com/OpenGeoMetadata/#{repo}.git"
Git.clone(repo_url, repo, path: repo_path, depth: 1) && 1
Git.clone(repo_url, nil, path: ogm_path, depth: 1) && 1
end

private
Expand Down
4 changes: 2 additions & 2 deletions spec/lib/geo_combine/harvester_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@
harvester.clone(repo_name)
expect(Git).to have_received(:clone).with(
repo_url,
repo_name, {
nil, {
depth: 1, # shallow clone
path: repo_path
path: harvester.ogm_path
}
)
end
Expand Down

0 comments on commit 6470322

Please sign in to comment.