onelson / estuary

33 stars 8 forks source link

Add `PackageIndex` struct, convert functions needing root/repo to methods. #3

Closed onelson closed 3 years ago

onelson commented 3 years ago

Several of the loose functions used for managing the package index needed both the path of the directory where the index files are and the Repository instance used to handle the git interactions.

In order to simplify usage, we now store the Repository as a field on this struct and ask it what its workdir is when we need to build derived paths.

If we later need to rework the git aspects of this module to use a bare repo, note that Repository::workdir() will return None (causing our unwraps to panic). This should be fine since switching to a bare repo will also require us to update the way we push new file data into the repo (using index entries or something). It'll be a whole different thing.