mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 17:24:59 +00:00
Added --dirty-commits
This commit is contained in:
parent
a2fa4f2929
commit
4c76a8a242
3 changed files with 15 additions and 2 deletions
|
@ -218,7 +218,7 @@ class Coder:
|
||||||
if is_commit_command:
|
if is_commit_command:
|
||||||
return
|
return
|
||||||
|
|
||||||
if not self.auto_commits:
|
if not self.dirty_commits:
|
||||||
return
|
return
|
||||||
if not self.repo:
|
if not self.repo:
|
||||||
return
|
return
|
||||||
|
|
|
@ -133,6 +133,8 @@ def main(args=None, input=None, output=None):
|
||||||
action="store_true",
|
action="store_true",
|
||||||
dest="dirty_commits",
|
dest="dirty_commits",
|
||||||
help="Enable dirty commit of changes",
|
help="Enable dirty commit of changes",
|
||||||
|
env_var=f"{env_prefix}DIRTY_COMMIT",
|
||||||
|
default=True,
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--dry-run",
|
"--dry-run",
|
||||||
|
@ -204,7 +206,7 @@ def main(args=None, input=None, output=None):
|
||||||
use_ctags=args.ctags,
|
use_ctags=args.ctags,
|
||||||
verbose=args.verbose,
|
verbose=args.verbose,
|
||||||
)
|
)
|
||||||
if args.auto_commits:
|
if args.dirty_commits:
|
||||||
coder.commit(ask=True, prefix="wip: ", which="repo_files")
|
coder.commit(ask=True, prefix="wip: ", which="repo_files")
|
||||||
|
|
||||||
if args.apply:
|
if args.apply:
|
||||||
|
|
|
@ -51,6 +51,7 @@ class TestMain(TestCase):
|
||||||
with patch("aider.main.Coder") as MockCoder:
|
with patch("aider.main.Coder") as MockCoder:
|
||||||
main([])
|
main([])
|
||||||
_, kwargs = MockCoder.call_args
|
_, kwargs = MockCoder.call_args
|
||||||
|
assert kwargs["dirty_commits"] is True
|
||||||
assert kwargs["auto_commits"] is True
|
assert kwargs["auto_commits"] is True
|
||||||
assert kwargs["pretty"] is True
|
assert kwargs["pretty"] is True
|
||||||
|
|
||||||
|
@ -63,3 +64,13 @@ class TestMain(TestCase):
|
||||||
main(["--pretty"])
|
main(["--pretty"])
|
||||||
_, kwargs = MockCoder.call_args
|
_, kwargs = MockCoder.call_args
|
||||||
assert kwargs["pretty"] is True
|
assert kwargs["pretty"] is True
|
||||||
|
|
||||||
|
with patch("aider.main.Coder") as MockCoder:
|
||||||
|
main(["--no-dirty-commits"])
|
||||||
|
_, kwargs = MockCoder.call_args
|
||||||
|
assert kwargs["dirty_commits"] is False
|
||||||
|
|
||||||
|
with patch("aider.main.Coder") as MockCoder:
|
||||||
|
main(["--dirty-commits"])
|
||||||
|
_, kwargs = MockCoder.call_args
|
||||||
|
assert kwargs["dirty_commits"] is True
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue