diff --git a/aider/args.py b/aider/args.py index 8a0be245c..fb89062c6 100644 --- a/aider/args.py +++ b/aider/args.py @@ -436,6 +436,12 @@ def get_parser(default_config_files, git_root): default=False, help="Prefix all commit messages with 'aider: ' (default: False)", ) + group.add_argument( + "--git-commit-verify", + action=argparse.BooleanOptionalAction, + default=True, + help="Enable/disable git pre-commit hooks with --no-verify (default: True)", + ) group.add_argument( "--commit", action="store_true", diff --git a/aider/main.py b/aider/main.py index 684ff3d30..2e0299e66 100644 --- a/aider/main.py +++ b/aider/main.py @@ -869,6 +869,7 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F attribute_commit_message_committer=args.attribute_commit_message_committer, commit_prompt=args.commit_prompt, subtree_only=args.subtree_only, + git_commit_verify=args.git_commit_verify, ) except FileNotFoundError: pass diff --git a/aider/repo.py b/aider/repo.py index b0956973f..94143b5f3 100644 --- a/aider/repo.py +++ b/aider/repo.py @@ -56,6 +56,7 @@ class GitRepo: attribute_commit_message_committer=False, commit_prompt=None, subtree_only=False, + git_commit_verify=True, ): self.io = io self.models = models @@ -69,6 +70,7 @@ class GitRepo: self.attribute_commit_message_committer = attribute_commit_message_committer self.commit_prompt = commit_prompt self.subtree_only = subtree_only + self.git_commit_verify = git_commit_verify self.ignore_file_cache = {} if git_dname: @@ -133,7 +135,9 @@ class GitRepo: # if context: # full_commit_message += "\n\n# Aider chat conversation:\n\n" + context - cmd = ["-m", full_commit_message, "--no-verify"] + cmd = ["-m", full_commit_message] + if not self.git_commit_verify: + cmd.append("--no-verify") if fnames: fnames = [str(self.abs_root_path(fn)) for fn in fnames] for fname in fnames: