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

Pre-Commit Hook Not Working with Husky #237

Open
1 task
Armadillidiid opened this issue Aug 3, 2023 · 1 comment
Open
1 task

Pre-Commit Hook Not Working with Husky #237

Armadillidiid opened this issue Aug 3, 2023 · 1 comment
Labels
bug Something isn't working pending triage

Comments

@Armadillidiid
Copy link

Bug description

Issue Description:
I am encountering an issue with the aicommits pre-commit hook when using it alongside husky in my Git repository. The aicommits tool is designed to generate commit messages based on the staged files, but when I stage my files and attempt to commit, no generated commits appear in the commit editor.

Steps to Reproduce:

  1. Install and set up husky in the Git repository for pre-commit hook management.
    
  2. Install and configure aicommits to generate commit messages based on staged files.
    
  3. Stage one or more files using git add <file>.
    
  4. Attempt to make a commit using git commit.
    

Expected Behavior:

Upon running git commit, the aicommits pre-commit hook should generate a commit message based on the staged files, and this message should appear in the commit editor for review before the actual commit is made.

Actual Behavior:

After staging files and running git commit, the commit editor is opened, but there are no generated commit messages. I am required to write a commit message manually instead of seeing the generated commit message as expected.

Additional Information:

I have verified that aicommits is properly installed and working outside of Husky, generating commit messages as expected when using git commit directly.
I have double-checked that Husky is configured correctly in the repository and other pre-commit hooks (if any) are working as intended.
I am using husky 8.0.0 version
The issue occurs on both Unix-like

Husky pre-commit file

#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged

aicommits version

v1.11.0

Environment

System:
    OS: Linux 6.3 Arch Linux
    CPU: (12) x64 AMD Ryzen 5 4600H with Radeon Graphics
    Memory: 6.49 GB / 15.00 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 19.7.0 - ~/.nvm/versions/node/v19.7.0/bin/node
    Yarn: 1.22.19 - /usr/bin/yarn
    npm: 9.5.0 - ~/.nvm/versions/node/v19.7.0/bin/npm

Can you contribute a fix?

  • I’m interested in opening a pull request for this issue.
@Armadillidiid Armadillidiid added bug Something isn't working pending triage labels Aug 3, 2023
@Keshavdulal
Copy link

Similar case: #250 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pending triage
Projects
None yet
Development

No branches or pull requests

2 participants