mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-25 06:44:59 +00:00
feat: Add --git-commit-verify flag to control git hook verification
This commit is contained in:
parent
aca64071c8
commit
ac231e43ad
3 changed files with 12 additions and 1 deletions
|
@ -436,6 +436,12 @@ def get_parser(default_config_files, git_root):
|
||||||
default=False,
|
default=False,
|
||||||
help="Prefix all commit messages with 'aider: ' (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(
|
group.add_argument(
|
||||||
"--commit",
|
"--commit",
|
||||||
action="store_true",
|
action="store_true",
|
||||||
|
|
|
@ -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,
|
attribute_commit_message_committer=args.attribute_commit_message_committer,
|
||||||
commit_prompt=args.commit_prompt,
|
commit_prompt=args.commit_prompt,
|
||||||
subtree_only=args.subtree_only,
|
subtree_only=args.subtree_only,
|
||||||
|
git_commit_verify=args.git_commit_verify,
|
||||||
)
|
)
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -56,6 +56,7 @@ class GitRepo:
|
||||||
attribute_commit_message_committer=False,
|
attribute_commit_message_committer=False,
|
||||||
commit_prompt=None,
|
commit_prompt=None,
|
||||||
subtree_only=False,
|
subtree_only=False,
|
||||||
|
git_commit_verify=True,
|
||||||
):
|
):
|
||||||
self.io = io
|
self.io = io
|
||||||
self.models = models
|
self.models = models
|
||||||
|
@ -69,6 +70,7 @@ class GitRepo:
|
||||||
self.attribute_commit_message_committer = attribute_commit_message_committer
|
self.attribute_commit_message_committer = attribute_commit_message_committer
|
||||||
self.commit_prompt = commit_prompt
|
self.commit_prompt = commit_prompt
|
||||||
self.subtree_only = subtree_only
|
self.subtree_only = subtree_only
|
||||||
|
self.git_commit_verify = git_commit_verify
|
||||||
self.ignore_file_cache = {}
|
self.ignore_file_cache = {}
|
||||||
|
|
||||||
if git_dname:
|
if git_dname:
|
||||||
|
@ -133,7 +135,9 @@ class GitRepo:
|
||||||
# if context:
|
# if context:
|
||||||
# full_commit_message += "\n\n# Aider chat conversation:\n\n" + 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:
|
if fnames:
|
||||||
fnames = [str(self.abs_root_path(fn)) for fn in fnames]
|
fnames = [str(self.abs_root_path(fn)) for fn in fnames]
|
||||||
for fname in fnames:
|
for fname in fnames:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue