mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 02:05:00 +00:00
improved gitignore check logic
This commit is contained in:
parent
19e4787502
commit
1d0d91d71e
1 changed files with 4 additions and 6 deletions
|
@ -70,12 +70,14 @@ def setup_git(git_root, io):
|
||||||
return repo.working_tree_dir
|
return repo.working_tree_dir
|
||||||
|
|
||||||
|
|
||||||
import git
|
|
||||||
|
|
||||||
def check_gitignore(git_root, io, ask=True):
|
def check_gitignore(git_root, io, ask=True):
|
||||||
if not git_root:
|
if not git_root:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
repo = git.Repo(git_root)
|
||||||
|
if repo.ignored(".aider"):
|
||||||
|
return
|
||||||
|
|
||||||
pat = ".aider*"
|
pat = ".aider*"
|
||||||
|
|
||||||
gitignore_file = Path(git_root) / ".gitignore"
|
gitignore_file = Path(git_root) / ".gitignore"
|
||||||
|
@ -86,10 +88,6 @@ def check_gitignore(git_root, io, ask=True):
|
||||||
else:
|
else:
|
||||||
content = ""
|
content = ""
|
||||||
|
|
||||||
repo = git.Repo(git_root)
|
|
||||||
if repo.is_ignored(pat):
|
|
||||||
return
|
|
||||||
|
|
||||||
if ask and not io.confirm_ask(f"Add {pat} to .gitignore (recommended)?"):
|
if ask and not io.confirm_ask(f"Add {pat} to .gitignore (recommended)?"):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue