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

Question: Why are git hooks disabled by default? #2885

Open
Timeraa opened this issue Feb 23, 2024 · 8 comments
Open

Question: Why are git hooks disabled by default? #2885

Timeraa opened this issue Feb 23, 2024 · 8 comments
Labels
enhancement An improvement to an existing feature git Something related to compatibility with Git UX something related to the user's experience

Comments

@Timeraa
Copy link

Timeraa commented Feb 23, 2024

So far I really enjoy using GitButler but I do always find myself confused as to why git hooks are disabled by default as those ensure consistent stable/linted code.

Is there any reason behind this or am I just using it wrong?

@schacon
Copy link
Member

schacon commented Feb 23, 2024

Nope, I think it's reasonable that if the hooks exist and are executable, you expect them to be executed. I think we were hesitant to just run stuff without you knowing we would run stuff, but I think opt-out makes more sense in this case.

@Timeraa
Copy link
Author

Timeraa commented Feb 24, 2024

Maybe you guys should enable this setting in a future update and change it to be enabled by default and letting people know about this change? (Because it's really tedious to enable it for all my projects)

@TGTGamer
Copy link

I actually disagree with this change.

Take a tool like trunk.io, an amazing tool which can manage you git hooks, but it still explictictly asks to enable git hooks.

I think turning on by default in a Git Tool like this could lead to confusion with some users, leading to them blaming butler for not working when their hooks might be the thing which is incompatible. There should be an explicit understanding when the hooks are enabled which separates the hook problems from the client.

@Timeraa
Copy link
Author

Timeraa commented Feb 27, 2024

I don't think it would cause issues, I saw GitButler improved how it shows errors from git hooks, they only run if you set them up anyway but if your team uses git hooks and someone uses GitButler and doesn't know that they are off by default they end up committing broken code or unlinted code which in my opinion causes more issues.

I think when you first import it there should be an option which is checked by default giving the user the choice.

@TGTGamer
Copy link

TGTGamer commented Feb 27, 2024

If your team uses git hooks and someone uses GitButler and doesn't know that they are off by default

This is where my point about things breaking comes from though, I could say the reverse. Some of my team, don't understand how Git Hooks work - not fully at least - and on a few occasions when something has gone wrong, I've had users come to me with "My VSCode is broken" and it turns out to be a hook isn't playing nice and isn't well displayed to the user.


I think the key takeaway is:

Whichever way the default hooks toggle is set - it needs to be displayed to the user when initialising a project

So maybe the solution here is to add a UI element to the initialisation page asking if the user wants the hooks, then add option in a configuration file for centrally managing it.

@Qix-
Copy link
Contributor

Qix- commented Mar 4, 2024

@schacon VSCode prompts "do you trust this repository" when you open it. We could replicate that, then store a local gitbutler.trusted=1 config value.

@jhnns
Copy link

jhnns commented Mar 21, 2024

I don't think that the user needs to be asked. If git is executing the hooks, I also expect GitButler to do so. I can't come up with a use case where you want regular git users to execute hooks but somehow GitButler users not.

@Timeraa
Copy link
Author

Timeraa commented Mar 25, 2024

I don't think that the user needs to be asked. If git is executing the hooks, I also expect GitButler to do so. I can't come up with a use case where you want regular git users to execute hooks but somehow GitButler users not.

Yeah, like why setup git hooks if you get the option to not run them by default? Like with normal git you can use --no-verify to disable them temporarily but they are on by default.

@Byron Byron added enhancement An improvement to an existing feature UX something related to the user's experience git Something related to compatibility with Git labels Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An improvement to an existing feature git Something related to compatibility with Git UX something related to the user's experience
Projects
None yet
Development

No branches or pull requests

6 participants