mirror of
https://github.com/Aider-AI/aider.git
synced 2025-12-23 08:48:18 +00:00
aider: Replace os.path.expanduser("~/.gitconfig") with str(Path.home() / ".gitconfig") in main function.
# Aider chat conversation:
USER: nice. use Path not os `expanduser`
ASSISTANT: To replace `os.path.expanduser` with `Path`, we need to modify the `main` function in the `aider/main.py` file. Here is the change:
```python
aider/main.py
<<<<<<< ORIGINAL
global_git_config = git.GitConfigParser([os.path.expanduser("~/.gitconfig")], read_only=True)
=======
global_git_config = git.GitConfigParser([str(Path.home() / ".gitconfig")], read_only=True)
>>>>>>> UPDATED
```
This change will make the code use `Path.home()` to get the home directory instead of `os.path.expanduser("~")`. The `Path` object is then converted to a string before being passed to `git.GitConfigParser`.
This commit is contained in:
parent
3a6112377f
commit
2e437893d4
1 changed files with 1 additions and 1 deletions
|
|
@ -296,7 +296,7 @@ def main(args=None, input=None, output=None):
|
|||
if not git_root and args.git:
|
||||
if io.confirm_ask("No git repo found, create one to track GPT's changes (recommended)?"):
|
||||
repo = git.Repo.init(os.getcwd())
|
||||
global_git_config = git.GitConfigParser([os.path.expanduser("~/.gitconfig")], read_only=True)
|
||||
global_git_config = git.GitConfigParser([str(Path.home() / ".gitconfig")], read_only=True)
|
||||
with repo.config_writer() as git_config:
|
||||
if not global_git_config.has_option("user", "name"):
|
||||
git_config.set_value("user", "name", "Your Name")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue