aider icon indicating copy to clipboard operation
aider copied to clipboard

let aiderignore use info/exclude

Open Konfekt opened this issue 1 year ago • 2 comments

Issue

aiderignore suggests to edit the project-wide gitignore to exlude .aider.* files; however not every user must use aider as it is not a build requirement. For personal setup, use .git/info/exclude instead

Version and model info

No response

Konfekt avatar Sep 23 '24 13:09 Konfekt

Thank you for filing this issue.

If I understand your question/suggestion correctly, you do not want to have to put the .aider.* entry in every project .gitignore which you use aider for, correct?

You can create a global gitignore file (e.g. ~/.config/git/ignore and put

.aider.*

in it, then those files will get automatically ignored in every project, without the need to put this entry into every project.gitignore file, also aider will not bother you about this anymore.

fry69 avatar Sep 23 '24 13:09 fry69

It's just that it is bad practice to spam a common .gitignore files with your personal setup, like files produced by your IDE or command-line tools, and aider should rather facilitate best than bad practice. A global personal .gitignore is a work-around but I am still under the impression that .gitignore is rather for build artifacts.

Konfekt avatar Sep 23 '24 13:09 Konfekt

Aider won't modify an existing .gitignore file without asking you first.

paul-gauthier avatar Oct 07 '24 20:10 paul-gauthier

That's good, point is that even better would be asking about modifying info/exclude instead of .gitignore. Even if of all repo users agree on Aider being an indispensable build tool, it's still rather meant for build output artifacts.

Konfekt avatar Oct 08 '24 02:10 Konfekt

Aider won't offer to modify .gitignore if you add .aider* to .git/info/exclude or to .gitignore_global.

paul-gauthier avatar Oct 08 '24 02:10 paul-gauthier

That's good for those who got it right from the start, though the help entry for --gitignore read as if those who did not add them there would be led astray (by proposing an entry to .gitignore first by default).

Konfekt avatar Oct 08 '24 03:10 Konfekt

For example, I start in aider in a new repo and it says

$ aider
Add .aider* to .gitignore (recommended)? (Y)es/(N)o [Yes]:    

The point I was trying to make that this is not to be recommended.

Instead, I'd gladly add them to .git/info/exclude instead, if for matter of fact, it hadn't already happened as I added them there in the git template folder.

So my advice is to document this and let the user decide instead of aider pushing for it.

Konfekt avatar Oct 15 '24 09:10 Konfekt

This issue has been labelled stale because it has been open for 2 weeks with no activity. Remove stale label or add a comment to keep this issue open. Otherwise, it will be closed in 7 days.

github-actions[bot] avatar Oct 30 '24 02:10 github-actions[bot]

This issue was closed because it has been stalled for 3 weeks with no activity. Feel free to add a comment here and we can re-open it. Or feel free to file a new issue any time.

github-actions[bot] avatar Nov 07 '24 02:11 github-actions[bot]

¯\(ツ)

Konfekt avatar Nov 07 '24 06:11 Konfekt

Aider won't offer to modify .gitignore if you add .aider* to .git/info/exclude or to .gitignore_global.

Hi @paul-gauthier

Looks like aider doesn't respect that.

Step1: When I run cat .git/info/exclude

The result is

# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
# *aider*
.aider*

When running aider, it still asks for .aider* and .env to gitignore...

PrashamTrivedi avatar Nov 11 '24 07:11 PrashamTrivedi

Just

## Enable/disable adding .aider* to .gitignore (default: True)
gitignore: false

as a new default would work for now

Konfekt avatar Nov 11 '24 09:11 Konfekt

Aider looks to be sure that .aider* and .env are excluded. It honors any way that git supports such exclusions:

(aider) macbook:...tmp/new$ git init
(aider) macbook:...tmp/new$ echo '.aider*' > .git/info/exclude
(aider) macbook:...tmp/new$ echo '.env' >> .git/info/exclude
(aider) macbook:...tmp/new$ aider
──────────────────────────────────────────────────────────────────────────────────────────────────────────────
Aider v0.62.2.dev
Main model: claude-3-5-sonnet-20241022 with diff edit format, infinite output
Weak model: claude-3-5-haiku-20241022
Git repo: .git with 0 files
Repo-map: using 1024 tokens, auto refresh
Use /help <question> for help, run "aider --help" to see cmd line args
──────────────────────────────────────────────────────────────────────────────────────────────────────────────
>

paul-gauthier avatar Nov 11 '24 16:11 paul-gauthier

Aider looks to be sure that .aider* and .env are excluded. It honors any way that git supports such exclusions:

(aider) macbook:...tmp/new$ git init
(aider) macbook:...tmp/new$ echo '.aider*' > .git/info/exclude
(aider) macbook:...tmp/new$ echo '.env' >> .git/info/exclude
(aider) macbook:...tmp/new$ aider
──────────────────────────────────────────────────────────────────────────────────────────────────────────────
Aider v0.62.2.dev
Main model: claude-3-5-sonnet-20241022 with diff edit format, infinite output
Weak model: claude-3-5-haiku-20241022
Git repo: .git with 0 files
Repo-map: using 1024 tokens, auto refresh
Use /help <question> for help, run "aider --help" to see cmd line args
──────────────────────────────────────────────────────────────────────────────────────────────────────────────
>

Thanks for the work @paul-gauthier . I believe this is available in master branch build, in that case I will check it tomorrow (around 12 hours from now).

PrashamTrivedi avatar Nov 11 '24 16:11 PrashamTrivedi

This should be working this way in the released version.

paul-gauthier avatar Nov 11 '24 17:11 paul-gauthier

Aider looks to be sure that .aider* and .env are excluded. It honors any way that git supports such exclusions:

This is not true for me in aider 0.73.0.

> git status --ignored
On branch master
Your branch is up to date with 'origin/master'.

Ignored files:
  (use "git add -f <file>..." to include in what will be committed)
	.aider.chat.history.md
	.aider.input.history
	.aider.tags.cache.v3/
	smu
	smu.o

nothing to commit, working tree clean
> aider
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Add .aider* to .gitignore (recommended)? (Y)es/(N)o [Yes]:         

I use a global gitignore, so at least https://github.com/Aider-AI/aider/issues/3072 is still open.

karlb avatar Feb 02 '25 18:02 karlb