mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-28 08:14:59 +00:00
aider: Changed set_repo function to print git repo name relative to cwd.
# Context: USER: when printing the git repo name, print it relative to cwd ASSISTANT: To print the git repo name relative to the current working directory, you can modify the `set_repo` function in the `aider/coder.py` file. Here's the change: ```python aider/coder.py <<<<<<< ORIGINAL if num_repos == 0: self.io.tool_error("Files are not in a git repo.") return if num_repos > 1: self.io.tool_error("Files are in different git repos.") return # https://github.com/gitpython-developers/GitPython/issues/427 repo = git.Repo(repo_paths.pop(), odbt=git.GitDB) self.root = repo.working_tree_dir self.io.tool("Using git repo:", self.repo.git_dir) ======= if num_repos == 0: self.io.tool_error("Files are not in a git repo.") return if num_repos > 1: self.io.tool_error("Files are in different git repos.") return # https://github.com/gitpython-developers/GitPython/issues/427 repo = git.Repo(repo_paths.pop(), odbt=git.GitDB) self.root = repo.working_tree_dir rel_repo_dir = os.path.relpath(self.repo.git_dir, os.getcwd()) self.io.tool("Using git repo:", rel_repo_dir) >>>>>>> UPDATED ``` This change replaces `self.repo.git_dir` with `os.path.relpath(self.repo.git_dir, os.getcwd())` to display the git repo path relative to the current working directory.
This commit is contained in:
parent
f28fc5b2b1
commit
4244eefb4a
1 changed files with 2 additions and 0 deletions
|
@ -108,6 +108,8 @@ class Coder:
|
|||
|
||||
self.root = repo.working_tree_dir
|
||||
|
||||
rel_repo_dir = os.path.relpath(self.repo.git_dir, os.getcwd())
|
||||
self.io.tool("Using git repo:", rel_repo_dir)
|
||||
new_files = []
|
||||
for fname in self.abs_fnames:
|
||||
relative_fname = self.get_rel_fname(fname)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue