mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-24 14:25:00 +00:00
Add --commit flag to commit dirty files without confirmation
This commit is contained in:
parent
f9569e7645
commit
a096c6e5e4
1 changed files with 8 additions and 8 deletions
14
coder.py
14
coder.py
|
@ -473,10 +473,12 @@ class Coder:
|
||||||
if not res:
|
if not res:
|
||||||
self.console.print("[red]Skipped commmit.")
|
self.console.print("[red]Skipped commmit.")
|
||||||
return
|
return
|
||||||
else:
|
|
||||||
repo.git.add(*relative_dirty_fnames)
|
repo.git.add(*relative_dirty_fnames)
|
||||||
repo.git.commit("-m", commit_message)
|
commit_result = repo.git.commit("-m", commit_message, "--no-verify")
|
||||||
self.console.print("[green]Commit successful.")
|
commit_hash = repo.head.commit.hexsha[:7]
|
||||||
|
self.console.print(f"[green]Commit successful. Short hash: {commit_hash}")
|
||||||
|
return commit_hash
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
@ -505,7 +507,7 @@ def main():
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--commit",
|
"--commit",
|
||||||
action="store_true",
|
action="store_true",
|
||||||
help="Commit dirty changes to the files",
|
help="Commit dirty files without confirmation",
|
||||||
)
|
)
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
@ -515,9 +517,7 @@ def main():
|
||||||
pretty = args.pretty
|
pretty = args.pretty
|
||||||
|
|
||||||
coder = Coder(use_gpt_4, fnames, pretty)
|
coder = Coder(use_gpt_4, fnames, pretty)
|
||||||
if args.commit:
|
coder.commit("", ask=args.commit)
|
||||||
coder.commit("", ask=True)
|
|
||||||
return
|
|
||||||
|
|
||||||
if args.apply:
|
if args.apply:
|
||||||
with open(args.apply, "r") as f:
|
with open(args.apply, "r") as f:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue