Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ A sample configuration:
repos:
# […]
- repo: https://github.com/erikogan/prevent-submodule-regression
rev: v0.1.2
rev: v0.1.3
hooks:
- id: prevent-submodule-regression
# By default hooks only operate on plain files, which do not include
Expand Down
2 changes: 1 addition & 1 deletion prevent_submodule_regression/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.1.2"
__version__ = "0.1.3"
5 changes: 3 additions & 2 deletions prevent_submodule_regression/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ def run(self, args):
for path in args:
self.process(path)

exit(0)

def process(self, path):
if not self.is_staged(path):
return
Expand All @@ -41,7 +43,6 @@ def process(self, path):
f" {Fore.CYAN}{path}{Style.RESET_ALL} SHA {Fore.YELLOW}{current_sha}{Style.RESET_ALL}"
" was already committed. This appears to be a regression."
)
exit(0)

def submodule_sha(self, path):
result = subprocess.run(
Expand Down Expand Up @@ -80,7 +81,7 @@ def extract_sha(commit, path):
return res
return res[1]

return [extract_sha(c, path) for c in commits]
return [extract_sha(c, path) for c in commits if commits != [""]]

def list_of_submodules(self):
# Rely on the fact that the .gitmodules file is in git config format
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "prevent-submodule-regression"
version = "0.1.2"
version = "0.1.3"
description = "Pre-commit hook to prevent accidental submodule regressions"
authors = ["Erik Ogan <erik@ogan.net>"]
maintainers = ["Erik Ogan <erik@ogan.net>"]
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.1.2
current_version = 0.1.3
commit = True
tag = True
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(?:\.(?P<build>\d+))?
Expand Down
2 changes: 1 addition & 1 deletion tests/test_prevent_submodule_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@


def test_version():
assert __version__ == "0.1.2"
assert __version__ == "0.1.3"