rkotze / git-mob

Co-author commits tool. A cross-platform command-line tool for social coding. Includes co-authors in commits when pair/mob programming.
https://www.npmjs.com/package/git-mob
MIT License
183 stars 21 forks source link

pre-commit configuration does not work as per the Readme #123

Closed abelazo closed 9 months ago

abelazo commented 9 months ago

Prerequisites

Description

git mob fails in the CLI when installed via pre-commit hooks.

Steps to Reproduce

  1. Create a new git repository
  2. Add a .pre-commit-config.yaml with the following configuration (latest version when this isssue was created):
    repos:
    - repo: https://github.com/rkotze/git-mob
    rev: v3.2.0
    hooks:
      - id: add-coauthors
        stages: ['prepare-commit-msg']
  3. Install the pre-commit hook by running pre-commit install --hook-type prepare-commit-msg
  4. Create a commit (no need to add co-authors)

Expected behavior: The commit works.

Actual behavior: Hook fails with the following message:

add-coauthors............................................................Failed
- hook id: add-coauthors
- exit code: 1
Executable `<user_home>/.cache/pre-commit/repo3kja4lqk/blob/master/packages/git-mob/hook-examples/prepare-commit-msg-nodejs` not found

The file is not present in the .cache folder. A visual inspection on the cache files seems to indicate pre-commit checks out the code, not the Github blob files.

I'm not an expert in pre-commit hooks but I think it could be enough updating the .pre-commit-hooks.yaml file removing the /blob/master string from the entry value.

Reproduces how often: 100% reproducible

Versions

Additional Information

I tried forking the repo and applying the change in the fork. The suggested change works. However, as I mentioned I'm not an expert on pre-commit hooks and I cannot evaluate the side effects of the change.

rkotze commented 9 months ago

Hi @abelazo

Thank you for logging the issue and following the template.

Your suggestion to solve the issue sounds good to me. Would you like to make a PR? I'll be happy to merge that in.

Thanks.