Visitar URL original
Sign-off git commit if all pre-commit checks pass · Issue #582 · pre-commit/pre-commit · GitHub
The Wayback Machine - https://web.archive.org/web/20220603150253/https://github.com/pre-commit/pre-commit/issues/582
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

Sign-off git commit if all pre-commit checks pass #582

Open
ylogx opened this issue Aug 8, 2017 · 6 comments
Open

Sign-off git commit if all pre-commit checks pass #582

ylogx opened this issue Aug 8, 2017 · 6 comments
Labels

Comments

@ylogx
Copy link

@ylogx ylogx commented Aug 8, 2017 •

It would be great if there was an option to add a sign at the end of commit message, that this commit was verified by pre-commit.

A dummy git commit message maybe:

Do some amazing thing to database connection

This commit will do amazing magical things.
More such things

NOTE:
* It will also make the moon brighter
* It will make the sun shine better

Signed-off-by: Shubham Chaudhary <shubham@chaudhary.xyz>
Signed-off-by: pre-commit verified with 8 hooks
@ylogx ylogx changed the title Sign git commit if all pre-commit checks pass Sign-off git commit if all pre-commit checks pass Aug 8, 2017
@asottile
Copy link
Member

@asottile asottile commented Aug 8, 2017

This sounds like a really cool idea -- and I think the latest updates which add commit-msg hooks could support this idea.

The concerns I have about this:

  • What about --no-verify?
    • Neither .git/hooks/pre-commit nor .git/hooks/commit-msg run when --no-verify is passed, so nothing happens
  • What about SKIP?
    • This could be detected by a cli and adjust the number of hooks
  • What about hooks that don't affect any files?
    • I'd still consider these hooks to have "run", but trivially -- it'd be quite difficult to figure out which ones were applicable without replicating the entire logic of pre-commit in a hook
  • How would a client hook know if all the hooks passed?
    • Simply put, it wouldn't but I don't think that's actually a problem -- in the case of pre-commit hooks failing, it would never get to the commit-msg hook which does the modification.
    • When another commit-msg hook fails, even if the hook has done the modification to the commit message the commit would still get properly cancelled

If you don't mind, I'm going to create another repository and start hacking away on this idea -- I think this is a good one :)

@asottile
Copy link
Member

@asottile asottile commented Aug 8, 2017

For a first pass, I'm just going to hardcode a message -- we can work on making it fancier in the future if that's desirable :)

@ylogx
Copy link
Author

@ylogx ylogx commented Aug 9, 2017 •

👍 Makes sense.

@asottile
Copy link
Member

@asottile asottile commented Sep 5, 2017

Just an update on this, I am still working on it though I've put this more on the back burner. Due to the tight coupling between pre-commit and this hook I think it makes more sense to keep this internal to the framework. So now I'm mostly stuck on how to enable such a thing -- I have a hunch I'll want to do something with #414

@asottile
Copy link
Member

@asottile asottile commented Oct 30, 2017

A framework for adding something like this was contributed as part of #643

@MaxymVlasov
Copy link

@MaxymVlasov MaxymVlasov commented Nov 13, 2021

JFYI, it is already done as pre-commit hook
https://github.com/mattlqx/pre-commit-sign

droctothorpe pushed a commit to droctothorpe/pre-commit that referenced this issue Mar 23, 2022
Disallow any branch name in checks_vcs_permalinks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants