Skip to main content

Pre-commit hook to prevent accidental submodule regressions

Project description

prevent-submodule-regression

Pre-commit hook to prevent accidental submodule regressions

Description

Do you find yourself (or your collaborators) constantly rolling back submodule SHAs because someone forgot to git submodule update before running git add . or git commit -a …?

This pre-commit plugin will prevent those nasty surprises from making their way into your repositories.

Installation

As a git hook

The simplest way to use this package is as a plugin to pre-commit.

A sample configuration:

repos:
  # […]
  - repo: https://github.com/erikogan/prevent-submodule-regression
    rev: v0.1.3
    hooks:
      - id: prevent-submodule-regression
        # By default hooks only operate on plain files, which do not include
        # submodules. This setting has been added to the hook configuration,
        # and should only be necessary if you are running a version older than
        # 0.1.3. Keeping it here for posterity, it can safely be skipped.
        types: [directory]

Example failure output:

submodule example with colorized output

As a standalone script

pip install prevent-submodule-regression [path…]

If you run the script with no arguments, it will automatically find all the configured submodules. You can also pass it a list of files to check.

It will currently ignore any path that is not staged to be commit. A future version of the script will have an argument to override that behavior.

TODO

In no particular order:

  • Actual tests
  • Ways to override the error and allow you to commit a regression.
    • Command-line
    • Environment variables
  • Ways to override (or disable) colorization codes
    • Command-line
    • Environment variables
  • Usage information via --help
  • Actual command-line flag parsing

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

prevent-submodule-regression-0.1.3.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

prevent_submodule_regression-0.1.3-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file prevent-submodule-regression-0.1.3.tar.gz.

File metadata

File hashes

Hashes for prevent-submodule-regression-0.1.3.tar.gz
Algorithm Hash digest
SHA256 94bb098000d1cbd77ea096f212fb4e6bc6a5e0a9cc0afbcbd8ce2122a4071d88
MD5 0d4682e17c2da95124dd441fd7a795d5
BLAKE2b-256 6d644fac14fb52a9720efbafd019e59367eb2ef43e12ebd6759a766069b24722

See more details on using hashes here.

File details

Details for the file prevent_submodule_regression-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for prevent_submodule_regression-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 90cac6df597924f8a9cb7efba326ba1adb451a1ae0ab717e99c65b69b1328821
MD5 10fda74e93b9aaf405a3e018b11fd663
BLAKE2b-256 0e1dbf28bd1c78917e6ac526e5a63925909847fd56f38bd9f443a513ec106cab

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page