lib/r10k/git/rugged/thin_repository.rb in r10k-2.3.1 vs lib/r10k/git/rugged/thin_repository.rb in r10k-2.4.0

- old
+ new

@@ -42,12 +42,12 @@ end checkout(opts.fetch(:ref, 'HEAD')) end - def checkout(ref) - super(@cache_repo.resolve(ref)) + def checkout(ref, opts = {}) + super(@cache_repo.resolve(ref), opts) end # Fetch refs and objects from one of the Git remotes # # @param remote [String] The remote to fetch, defaults to 'cache' @@ -59,17 +59,31 @@ # @return [String] The cache remote URL def cache with_repo { |repo| repo.config['remote.cache.url'] } end + def tracked_paths(ref="HEAD") + with_repo do |repo| + commit = repo.rev_parse(ref) + + unless commit && commit.tree + raise R10K::Error.new("Unable to resolve '#{ref}' to a valid commit in repo #{@path}") + end + + commit.tree.walk(:postorder).collect do |root, entry| + root.empty? ? entry[:name] : File.join(root, entry[:name]) + end + end + end + private # Override the parent class repo setup so that we can make sure the alternates file is up to date # before we create the Rugged::Repository object, which reads from the alternates file. def setup_rugged_repo entry_added = alternates.add?(@cache_repo.objects_dir.to_s) if entry_added - logger.debug2 { "Updated repo #{@path} to include alternate object db path #{@cache_repo.objects_dir}" } + logger.debug2 { _("Updated repo %{path} to include alternate object db path %{objects_dir}") % {path: @path, objects_dir: @cache_repo.objects_dir} } end super end end