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

Add timeouts for commit hooks #2547

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Conversation

DaRacci
Copy link

@DaRacci DaRacci commented Mar 5, 2025

This Pull Request closes #2546.

It changes the following:

  • Adds timeouts to git hooks

I followed the checklist:

  • I added unittests
  • I ran make check without errors
  • I tested the overall application
  • I added an appropriate item to the changelog

@DaRacci
Copy link
Author

DaRacci commented Mar 5, 2025

Opening early as a draft.

Initial changes are working and have tests added for them just need to figure out how we are going to implement a timeout value, if thats user configuration or a default impl.

@DaRacci
Copy link
Author

DaRacci commented Mar 6, 2025

Was wanting to get some feedback on this before progressing further, is this the correct place to implement the timeout logic? @extrawurst

@extrawurst
Copy link
Collaborator

This would impact other users like Gitbutler. @Byron what do you think about this change?

@extrawurst extrawurst requested a review from Byron March 11, 2025 10:24
@extrawurst extrawurst requested a review from cruessler March 15, 2025 09:09
Copy link
Collaborator

@cruessler cruessler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From an implementation standpoint, this looks good. The only thing I would add is tests for non-zero timeouts (maybe that’s something you already planned or maybe I missed something).


let res = hooks_pre_commit(
&root.to_str().unwrap().into(),
Duration::ZERO,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be a non-zero value? At least, I was expecting a non-zero value based on the test’s name.

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.

Program hangs if repo uses prepare-commit-hook that requires user input
3 participants