Skip to content

Commit cd5a926

Browse files
committed
feat(bump): add optional --no-verify argument for bump command
1 parent 108c6dc commit cd5a926

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

commitizen/cli.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@
9292
"default": False,
9393
"help": "generate the changelog for the newest version",
9494
},
95+
{
96+
"name": ["--no-verify"],
97+
"action": "store_true",
98+
"default": False,
99+
"help": "disable git hooks during bumping",
100+
},
95101
{
96102
"name": "--yes",
97103
"action": "store_true",

commitizen/commands/bump.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ def __init__(self, config: BaseConfig, arguments: dict):
3131
}
3232
self.cz = factory.commiter_factory(self.config)
3333
self.changelog = arguments["changelog"]
34+
self.no_verify = arguments["no_verify"]
3435

3536
def is_initial_tag(self, current_tag_version: str, is_yes: bool = False) -> bool:
3637
"""Check if reading the whole git tree up to HEAD is needed."""
@@ -145,7 +146,7 @@ def __call__(self): # noqa: C901
145146
changelog()
146147

147148
self.config.set_key("version", new_version.public)
148-
c = git.commit(message, args="-a")
149+
c = git.commit(message, args=self._get_commit_args())
149150
if c.err:
150151
out.error('git.commit errror: "{}"'.format(c.err.strip()))
151152
raise SystemExit(COMMIT_FAILED)
@@ -154,3 +155,9 @@ def __call__(self): # noqa: C901
154155
out.error(c.err)
155156
raise SystemExit(TAG_FAILED)
156157
out.success("Done!")
158+
159+
def _get_commit_args(self):
160+
commit_args = ["-a"]
161+
if self.no_verify:
162+
commit_args.append("--no-verify")
163+
return " ".join(commit_args)

0 commit comments

Comments
 (0)