rwjblue / git-repo-info

MIT License
112 stars 28 forks source link

Add Caching Strategy #36

Open rwjblue opened 7 years ago

rwjblue commented 7 years ago

In some circumstances git-repo-info is invoked many times throughout the life of a process (e.g. in ember-cli apps where rebuilds are happening), but in most cases the .git info is completely unchanged.

We should add a caching strategy that uses very little I/O to determine if a new commit or tag has been made, and if not simply return the same value as the prior invocation.

stefanpenner commented 7 years ago

what sorta strategy did you have in mind? Just readdir of tags and see if they changed? Is that enough?

rwjblue commented 7 years ago

@stefanpenner - Yeah, something like that (for tags) and a simple fs.statSync should be enough to see if a new commit has been made.

stefanpenner commented 7 years ago

its not clear that that would be sufficiently fast. I wonder if its worth the complexity cost, or if the calling library is more responsible.