Skip to content

Commit

Permalink
Override public clone_repo_contents instead of private helper
Browse files Browse the repository at this point in the history
  • Loading branch information
jurre committed Oct 28, 2022
1 parent 8c331ce commit d9f4a86
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions npm_and_yarn/lib/dependabot/npm_and_yarn/file_fetcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,26 @@ def self.required_files_message
"Repo must contain a package.json."
end

private

# Overridden to pull any yarn data or plugins which may be stored with Git LFS.
def _clone_repo_contents(target_directory:)
path = super(target_directory: target_directory)
def clone_repo_contents
return @git_lfs_cloned_repo_contents_path if defined?(@git_lfs_cloned_repo_contents_path)

@git_lfs_cloned_repo_contents_path = super
begin
SharedHelpers.with_git_configured(credentials: credentials) do
Dir.chdir(path) do
Dir.chdir(@git_lfs_cloned_repo_contents_path) do
cache_dir = Helpers.fetch_yarnrc_yml_value("cacheFolder", "./yarn/cache")
SharedHelpers.run_shell_command("git lfs pull --include .yarn,#{cache_dir}")
end
path
@git_lfs_cloned_repo_contents_path
end
rescue StandardError
path
@git_lfs_cloned_repo_contents_path
end
end

private

def fetch_files
fetched_files = []
fetched_files << package_json
Expand Down

0 comments on commit d9f4a86

Please sign in to comment.