Skip to content

Commit

Permalink
Fix repository path lookup when custom Hatchet directory set (#181)
Browse files Browse the repository at this point in the history
Previously if a custom Hatchet `directory` was defined in `hatchet.json`,
passing a fixture name of the full repository name would not work.

Fixes #161.

Co-authored-by: Richard Schneeman <[email protected]>
  • Loading branch information
edmorley and schneems authored Jan 29, 2021
1 parent 2222c4a commit c7170b2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## HEAD


- Fix repository path lookup when custom Hatchet directory set (https://github.com/heroku/hatchet/issues/181)
- Handle additional variations of rate limit error messages (https://github.com/heroku/hatchet/pull/182)
- Add `HATCHET_DEFAULT_STACK` for configuring the default stack (https://github.com/heroku/hatchet/pull/184)
- Fix typo in the reaper `"Duplicate destroy attempted"` message (https://github.com/heroku/hatchet/pull/175)
Expand Down
2 changes: 1 addition & 1 deletion lib/hatchet/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def initialize(directory = '.')

# use this method to turn "codetriage" into repos/rails3/codetriage
def path_for_name(name)
possible_paths = [repos[name.to_s], "repos/#{name}", name].compact
possible_paths = [repos[name.to_s], "#{repo_directory_path}/#{name}", name].compact
path = possible_paths.detect do |path|
!(Dir[path] && Dir[path].empty?)
end
Expand Down
4 changes: 4 additions & 0 deletions spec/hatchet/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
expect(@config.path_for_name("rails3_mri_193")).to(eq("repo_fixtures/repos/rails3/rails3_mri_193"))
end

it("config path for name with full repo name") do
expect(@config.path_for_name("rails3/rails3_mri_193")).to(eq("repo_fixtures/repos/rails3/rails3_mri_193"))
end

it("config dirs") do
{ "repo_fixtures/repos/bundler/no_lockfile" => "https://github.com/sharpstone/no_lockfile.git", "repo_fixtures/repos/default/default_ruby" => "https://github.com/sharpstone/default_ruby.git", "repo_fixtures/repos/rails2/rails2blog" => "https://github.com/sharpstone/rails2blog.git", "repo_fixtures/repos/rails3/rails3_mri_193" => "https://github.com/sharpstone/rails3_mri_193.git" }.each do |key, value|
assert_include(key, value, @config.dirs)
Expand Down

0 comments on commit c7170b2

Please sign in to comment.