Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add refetch_frequency parameter to settings #857

Merged
merged 1 commit into from
Oct 29, 2024

Conversation

gabriel-ss
Copy link
Contributor

⚡ Summary

First of all, thanks everyone for the great tool!

The remote feature of lefthook allows us at the place where I work to easily share configuration across our hundreds of repositories. Usually, our devs have some dozens of repositories cloned on their machines and work actively in one or two at a time. To ensure that they will have a reasonably recent config when going back to a repo after some time, we configure our remotes with refetch: true, but this has the side effect that every time they run lefthook on a currently active repository, either by commiting something or by hand to manually check the output of the QA tools, they trigger a fetch.

To make the experience smother, this PR introduces a new parameter refetch_frequency that allows a more fine grained control over the remote refetching by allowing the definition of time periods instead of just a boolean flag. This is a working implementation already, but it defers some decisions that could be made to maybe improve the usability. I didn't want to touch the following points without consulting the core team before, but:

  • I think that this parameter superseds the current refetch, so maybe it could be marked deprecated;
  • I used ParseDuration from go's stdlib in the current implementation, but a more user-friendly format could be used at the cost of a new dependency.

I also apologize in advance for any oddities in the code, I'm not a go programmer, but I can make changes that you see fit to make the PR more fitting.

☑️ Checklist

  • Check locally
  • Add tests
  • Add documentation

@mrexox
Copy link
Member

mrexox commented Oct 28, 2024

Wow! Thank you for providing this PR! I will review it this week and will release if everything is good 👍

@mrexox mrexox merged commit 1bcc75c into evilmartians:master Oct 29, 2024
18 of 19 checks passed
@mrexox
Copy link
Member

mrexox commented Oct 29, 2024

Check out 1.8.2 version!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants