Skip to content

stage_fixed (or equivalent) for changed files not originally staged #806

@isturdy

Description

@isturdy

⚡ Summary

IIUC, currently stage_fixed only affects the files originally in the glob. I'm trying to use lefthook for code/documentation generation, and so some steps create/modify files not part of the original staged set/glob results.

Value

Allows using pre-commit for generated files (e.g. documentation)

Behavior and configuration changes

For a silly example, consider a hook that duplicates files:

pre-commit:
  commands:
    clone:
      stage_fixed: true
      glob: "*.txt"
      run: cp {staged_files} backup

I initially expected that this would commit both the manually-created file and its backup, but instead it commits the original file and creates the backup but does not stage/commit it. I would like to see a variant of stage_fixed that also adds any files not originally staged for the commit that change during the command.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestA new lefthook feature description

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions